Michal Grzegorzewski

Sponsors

The Lounge

Wicked Cool Jobs

Syndication

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Y2K7 problem - ymmdd pattern in AssemblyInfoVersion
The problem is well-known - all four parts of the version number are limited to 16-bit numbers. So, when you used versioning like this: x.y.z.ymmdd, thus when the 2007.01.01 arrived, you were in trouble and got the infamous csc error:

[csc] error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '1.0.1.70102' is invalid'

The users of the AssemblyInfoTask for msbuild had to do something when they got back to work just after the new-year's party ;). Actually I use NAnt instead of msbuild, but I really loved this way of 'stamping' my assemblies, so I used the pattern too. For example, in DotNetNuke modules, the version number consists of three numbers, so the last one (revision) is a very good place to store the build date.

  <tstamp property="build.date" pattern="yMMdd"/>
  <property name="build.version" value="${build.major}.${build.minor}.${build.build}.${build.date}" />

(other numbers coming from other place)
I didn't want to jump to the 'BuildDay' pattern, so I decided to cut the number % 50000.

  <property name="build.version" value="${build.major}.${build.minor}.${build.build}.${int::parse(build.date)%50000}" />

That way I've got now 5 years to change other numbers to not to get in trouble with 'previous version'... :) After all, I'm not fully satisfied with this solution and here comes the question: how do you play (if you do ;)) with the build-date in your assemblies?

Posted 03-04-2007 3:50 PM by Michal Grzegorzewski
Filed under: ,

[Advertisement]

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)