This documentation is archived and is not being maintained.

How to: Publish Web Application Projects 

By publishing a Web application project, Visual Studio compiles the files of a Web application into a single assembly and then copies the compiled assembly to a specified location. ASP.NET Web application projects share the same configuration settings and behavior as standard Visual Studio 2005 class-library projects. You can publish the Web application to a local or shared folder, to an FTP site, or to a Web site that you access by using a URL.

The Publish Web dialog box, which is located on the Visual Studio Build menu, enables you to build and publish Web applications. Additionally, you can choose to remove source code from the site. This provides a measure of protection for your intellectual property and makes it more difficult for others to access the source code of your site. For information about what happens to your files during precompilation, see File Handling During ASP.NET Precompilation.


The Publish Web dialog box only applies to projects created by using the ASP.NET Web Application template.

Before publishing your Web application, check the configuration of your original site and note the following:

  • Any settings that must exist at the remote location. Specifically, review settings such as connection strings, membership settings, and other security settings and make sure that that these settings are appropriate for your production environment.

  • Any settings that must be changed on the published Web site. For example, you might want to disable debugging, tracing, and custom errors after you publish your Web site.

Because configuration settings are inherited, you might need to examine multiple files to find all the applicable settings. Configuration settings can be located in the Machine.config file or the root Web.config file in the SystemRoot\Microsoft.NET\Framework\version\CONFIG directory, in addition to in any Web.config files in your application. If you do not have permission to view the root configuration files, you can output a file that contains a complete list of configuration settings for your Web site, formatted as a standard configuration file, by using the code example in How to: View Inherited and Local Configuration Settings Programmatically. For definitions of configuration settings, see General Configuration Settings (ASP.NET) and ASP.NET Configuration Settings.


To complete the following procedure, you must have both Create and Write permissions in the target location.

To publish a Web application project

  1. On the Build menu, click the Publish ProjectName option.

  2. In the Publish Web dialog box, click the ellipsis button (…) to browse to the location to which you want to publish the Web application project.

  3. Select either the Replace matching files with local copies check box or the Delete all existing files prior to publish check box.

  4. Select how you want to copy the Web application project files to the new location: Only files needed to run this application, All project files, or All files in the source project folder. Also, you can include files from the App_Data folder by selecting the related check box.

  5. Click OK to publish your Web application project.

    In the task bar, Publish succeeded displays when publishing is completed.

  6. Make any configuration changes that are required for your Web application at the target location. For more information, see How to: Configure Published Web Sites.


    To help increase security, you might want to encrypt specific configuration settings. For more information, see Encrypting Configuration Information Using Protected Configuration.

See Also


Publish Web Dialog Box

Other Resources

Web Application Projects Overview