If you want to add versioning information to the assemblies generated for a precompiled Web site, you can do the following:
- Add an AssemblyInfo.cs or AssemblyInfo.vb file to the App_Code folder. The assembly generated for the App_Code folder will then be versioned. You can also add version attributes to the code-behind files for pages and user controls. However, adding version attributes to individual files is tedious and applies only to code-behind files in an updatable precompilation layout.
- Add references to an AssemblyInfo.cs or AssemblyInfo.vb file to the compilerOptions attribute of the <compiler> element in the Web.config file. This enables you to add versioning for all assemblies generated for the Web site. In that case, you must include both C# and Visual Basic compilers because ASP.NET might select a compiler for non-code type files, such as WSDL, when compiling the proxies.
Aspnet_merge.exe can version the assemblies it creates by either copying the attributes from the App_Code assembly or copying them from a specific assembly specified using the –copyattrs option. This is therefore treated like any other assembly attribute. These options for specifying an attribute for the merged assembly or assemblies ensures that you can define all version attributes, including the file version, the assembly version, and any other assembly attributes you require.
Figure 25 shows the merge command used to apply attributes from the App_Code assembly, using the Web site shown in Figure 1. The AssemblyInfo.cs file shown in Figure 22 has been added to the Web site's App_Code folder.
Example
Aspnet_merge c:\precompileWebsite –copyattrs –a
0 comments:
Post a Comment