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.
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. For definitions of configuration settings, see and .
To complete the following procedure, you must have both Create and Write permissions in the target location.
To publish a Web application project
On the Build menu, click the Publish ProjectName option.
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.
Select either the Replace matching files with local copies check box or the Delete all existing files prior to publish check box.
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.
Click OK to publish your Web application project.
In the task bar, Publish succeeded displays when publishing is completed.
Make any configuration changes that are required for your Web application at the target location. For more information, see.
To help increase security, you might want to encrypt specific configuration settings. For more information, see.