Welcome to MSDN Blogs Sign in | Join | Help

How To: Use the AssemblyInfoTask With ASP.NET Web Deployment Projects

About once a week we get a question from someone who wants to know how to set the assembly version information on ASP.NET projects. I spoke with Bradley, a development lead over in the ASP.NET team who worked on the Web Deployment Projects, and it turns there are two ways you can do this.

If the only thing you're interested in doing is setting the version number on the web deployment project you can do that directly through UI properties on the deployment project instead of editing MSBuild files and downloading another task. For more information look at their walkthrough documentation.

If you want to set the version number as part of a larger build process that includes desktop assemblies and other class libraries you can use the AssemblyInfoTask and custom MSBuild XML. To make this work you need to add an assemblyinfo.cs (or .vb) to a folder called app_code under your top level directory. Once that file is there you can use the AssemblyInfoTask as you normally would to set the version number, and then use the Web Deployment Project to do the compliation of the assembly for the web.

[ Author: Neil Enns ]

Published Thursday, January 26, 2006 7:06 PM by msbuild

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Monday, August 20, 2007 5:57 PM by Ron

# re: How To: Use the AssemblyInfoTask With ASP.NET Web Deployment Projects

Neil,

Has this been tested?

I have a AssemblyInfo.cs file into my App_Code directory with the following attributes:

[assembly: AssemblyVersion("1.0.0.0")]

[assembly: AssemblyFileVersion("1.0.0.0")]

My WDP is set to merge all outputs to a single assembly.

My WDP file has the following entry:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets" />

I have an AfterBuild task but it never runs because:

Target "AfterBuild" skipped, due to false condition; ($(MaxAssemblyVersion) != '') was evaluated as ( != '').

Please advise.

Thanks,

Ron

Thursday, February 28, 2008 9:06 AM by Mike

# re: How To: Use the AssemblyInfoTask With ASP.NET Web Deployment Projects

UI goes *bork* when you try default version such as:

1.0.*

Even in the 2008 version.

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker