UPDATE: For information on the "Y7K" or "2007" issue, see our new blog entry

One of our most frequently asked questions is: "How do update my assembly version numbers at build time?". Unfortunately our answer has been "you can't". Until today, that is.

I just posted a new task, AssemblyInfoTask, at GotDotNet. It provides complete support for a wide variety of version number styles, from a fixed number to numbers that change daily to numbers that increment on every build. It also supports setting other properties such as AssemblyTitle, AssemblyCopyright, etc.

Even better, we've posted the complete source code, unit tests (that run in Visual Studio Team System), and raw documentation for the task under the new Microsoft Community License. Try not to laugh too hard when you look at the code. Remember, I don't write code for a living, I'm one of those touchy-feely Program Manager people :)

If all you want to do is get Visual Studio-style build numbers, of the form 1.0.yyMMdd.revision (for example, 1.0.51111.02 for the third build today), then you simply add the following line to your project file after any existing <Imports>:

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

If anyone has trouble getting it to work, has comments, questions, or suggestions, please send 'em our way to msbuild@microsoft.com or post to our forum.Enjoy!

[ Author: Neil Enns ]