Alex Rivera | Logout

How do I automatically set assembly version during nightly build?

Asked 2010-07-27T08:06:20.873
13

We have a nightly build process that automatically versions all C++ projecs. Here's how it works. There's a common header file VersionNumber.h that has a specific #define for the version number. The nighly build checks this file out, increments the integer behind that #define and checks it in. All Visual C++ projects #include that header into their resource files and use that define for specifying the version (version is smth like 1.0.3.ThatNumber).

So far so good. Now I'd like to have the same for the C# class libraries built in the same daily build. Currently they all have

[assembly: AssemblyVersion("1.0.*")]

in the AssemblyInfo.cs files and libraries end up with 1.0.HorribleNumber.AnotherHorribleNumber as the version and the two numbers don't correlate to the number used by C++ projects.

How do I have the same determenistic automatic version numbering in my C# projects with minimal effort?

Edit
Report

1 Answer

1

You can do something like you already do for your C++ technique, but search for the "assembly: AssemblyVersion( string and replace the number in quotes with the full, required version number.

In C# the wildcard on the version number tells the compiler to automatically update the version number -- if there's no wildcard, it will just use the full number supplied.

e.g.

[assembly: AssemblyVersion("1.0.3.10")]

Will always use that version number until you change it in the file.

answered 2010-07-27T08:11:44.433

Your Answer