Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Code Repository

Deploy a web project with only the necessary files


Deploy a web project with only the necessary files

When deploying a .NET web project Visual Studio.NET provides a great method for getting only the necessary files.

First, make certain that you have set your web.config file's compilation tag to debug="false"
  1. <compilation defaultLanguage="vb" debug="false">

(Remember that when you run your code again in Visual Studio.NET you have to change debug="false" back to "true" again or you'll get a "project is not configured to be debugged" error.)

.net 1.1

1. Switch your application to "Release" mode using the drop down in Visual Studio.NET.
2. Next make certain that your project is highlighted in the solution explorer by clicking on the web project's name once.
3. Click on the "Project" menu item in Visual Studio.NET and then click on "Copy Project".
4. In the Copy Project window that opens the recommended copy method is "File Share". Also make certain that the "Only files needed to run this application" radio button is selected. Finally, click the "OK" button.
5. You will now have a new website created that contains only the files your application needs to run. Copy these files to your production server.

.net 2.0 or higher

1. Click once on your web project's name in solution explorer to highlight it.
2. In the build menu click "Publish Website".
3. Select a location to send the files you need to.
4. I recommend precompiling your site (This may not be appropriate for all websites).
5. If prompted to delete all files in the destination directory click "Yes".
6. You now have a directory that contains only the files which are necessary to run your site.

Microsoft Certified Professional   © 2018 Fortunate.  All rights reserved.