Share via

How to: Deploy a Web Site Project by Using the Publish Web Site Tool

The Publish Web Site tool precompiles the files in a Web site project and then writes the output to a folder that you specify. For more information about precompilation and the Publish Web Site tool, see ASP.NET Web Site Project Precompilation Overview and The Publish Web Site Tool.


The Publish Web Site tool is not available in Visual Web Developer Express.


This topic applies only to Web site projects. For information about the difference between Web application projects and Web site projects, see Web Application Projects versus Web Site Projects in Visual Studio.

To publish a Web site project

  1. Optionally, before you deploy or redeploy a Web site project, prevent the production site from responding to page requests during the deployment process. This helps avoid errors that might result during the time when changes are only partially completed. Also, you might want to make sure that the application domain does not recycle multiple times during deployment. For more information, see How to: Prepare to Deploy a Web Project.

  2. Review your Web.config file settings to determine if any of them need to be different on the target server. For more information, see Configuring Deployed Web Site Projects.

  3. On the Build menu, click Publish Web Site.

  4. In the Publish Web Site dialog box, click the ellipsis button (…) to browse to the location where you want to publish the Web site files that are produced by compilation (the ultimate target server might be different).

    The target location can be a local or shared folder, an FTP site, or a Web site that you access with a URL. You must have permissions to create and write files in the target location.


    The results of compilation are written to the specified location, overwriting (without warning) any existing content in that location.

  5. To be able to change.aspx files after publishing the Web site (without recompiling them), select the Allow this precompiled site to be updatable check box.

    If you select this option, the markup is left as-is, allowing you to change HTML and client-side functionality after precompiling the Web site. Selecting this option is equivalent to adding the -u option to the aspnet_compiler.exe command. For more information, see Precompiling for Deployment with Updatable UI and ASP.NET Compilation Tool (Aspnet_compiler.exe).

  6. If you want to be able to update individual pages by recompiling them, select Use fixed naming and single page assemblies.

    This option might degrade the performance of a very large site. For more information, see the following topics:

  7. If you want to be able to debug in the published Web site, select Emit debug information.

  8. To create strongly named assemblies using a key file or a key container, select the Enable strong naming on precompiled assemblies check box, select the appropriate radio button, and enter the appropriate information Key file location or Key container box.

    Strong-named assemblies can be deployed to the server's global assembly cache (GAC) or to the Bin directory of the application. A signed assembly makes it more difficult for malicious users to replace the application's assemblies with malicious code. However, the complexity of key management in shared development environments might outweigh the advantages of signed assemblies. For information about strong-naming on assemblies, see the following topics:

  9. If you select Enable strong naming on precompiled assemblies, and if you use a key file, and if you want to delay the signing of the key file, select Delay signing.

    If you select this option, the assembly is signed in two stages: first with the public key file, and then with a private key file that is specified later during a call to the aspnet_compiler.exe command.

  10. If you selected Enable strong naming on precompiled assemblies, and if you want to allow the assemblies to be called by partially trusted code, select Mark assemblies with AllowPartiallyTrustedCallerAttribute (APTCA).

    Assemblies must have the AllowPartiallyTrustedCallersAttribute attribute to be called by the ASP.NET runtime. For more information, see AllowPartiallyTrustedCallersAttribute.

  11. Click OK.

    Publishing status is displayed in the taskbar. When publishing is completed, the status of Publish succeeded is displayed.

See Also


Walkthrough: Deploying a Web Site Project by Using the Publish Web Site Tool


ASP.NET Web Site Project Deployment Overview

Configuring Deployed Web Site Projects

Other Resources

ASP.NET Web Site Administration