How to: Publish and Generate Fixed Assembly Names in Visual Web Developer

By default, when you publish a Web site, ASP.NET compiles your Web site using batch compilation, where the compiler combines the outputs from multiple source files in each folder into a single assembly for each folder. The compiler determines which source outputs to combine based on a variety of factors, including dependencies between source files. Batch compilation assigns generated names to the resulting assemblies, which do not map directly to the original source files. With batch compilation, the assembly names are regenerated each time you publish your site.

Note

Visual Web Developer Express Edition does not support precompiling a site for deployment.

The assemblies created by batch compilation might not be suited for Web sites where you want to release updates to specific portions of the Web site without redeploying the entire site. In those cases, it might be more convenient to work with assemblies that map one-for-one with the source files and that have predictable names.

When you publish an ASP.NET Web site in Visual Web Developer, you have an option to generate fixed file names with single-page assemblies, which are compiled assemblies that each correspond to a single page or user control (that is to .aspx, .ascx, and .master files). The fixed file-name option also preserves the names of your assemblies when you compile and publish your Web site. When you use fixed file names with single-page assemblies, batch compilation is turned off for precompilation. (Themes and skin files, along with other folders that do not contain pages or user controls, will continue to be compiled to a single assembly.)

When you choose to generate fixed assembly names, ASP.NET will do the following:

  • Create an assembly for each .aspx, .ascx, and .master file in the application. You should limit the number pages in your application to reduce the number of assemblies that are generated.

  • Use the virtual path to the page as the name of the page's assembly. If the length of the virtual path exceeds the file-name length limit of the operating system, the tool uses a hash of the virtual path instead.

  • Compile the files in top-level directories, such as the App_Code directory, into a single assembly, as is done during batch compilation.

    Note

    There might be more than one code directory containing source code in the App_Code folder. You can configure the subfolders to be compiled into their own assemblies by modifying the Web.config file. For more information, see Shared Code Folders in ASP.NET Web Sites.

For more information about precompilation, see ASP.NET Web Site Precompilation.

To generate fixed assembly names for an ASP.NET Web site

  1. In Visual Web Developer, open a Web site that you want to deploy.

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

  3. To use fixed assembly names, select the Use fixed naming and single page assemblies check box.

  4. Click OK.

See Also

Tasks

How to: Publish Web Sites

Reference

Batch Build Dialog Box

Other Resources

ASP.NET Web Site Precompilation