views:

422

answers:

2

I want to make a target in my MSBuild script that:

  • Fetch SVN revision/datetime from sources folder ('svn info' command)
  • Update VERSIONINFO resource from .EXEs and .DLLs generated by 'build' target

There is something ready to accomplish this? I'm asking just before reinvent another wheel...

I'm giving a look into http://msbuildextensionpack.codeplex.com

+2  A: 

MSBuild Community Tasks Project is your friend. Check their "SvnInfo" task.

Also, Daniel Doubrovkine's ResourceLib is an excellent piece of work and can avoid you lots of headaches when trying to untangle the VERSIONINFO creation mess (been there, done that...)

F.D.Castel
Thank you very much!
r00kie
A: 

Much easier to do this before compilation by writing an AssemblyInfo file (or any file with assembly attributes) thats included in your projects.

Example of writing this in powershell found here: http://github.com/ayende/rhino-divandb/blob/a4d14de38f91326ab39b9b2492ea79ee6d903ed4/psake_ext.ps1

One caveat -- the versions in .net are not just any string but ushorts which means they have a max of 65535 (see docs here). If you use the svn revision (as we did at one point) your build will break once it exceeds that magic number.

Why would you be trying to do this after compilation?

craigb
The binaries are generated from 5 different compilers. None of them for .NET. Anyway, thanks for the tip about ushorts.
r00kie
OK, now I'm even more curious... what languages/compilers? Mention of DLLs and EXEs made me assume you were talking about standard .Net development (i.e. C#/VB, Visual Studio etc). If that isn't the case, why did you choose MSBuild?
craigb
As of VS2010, native C++ projects are built using msbuild. There are tools for updating Assembly version info but for natives, the version is still controlled via the applications VERSIONINFO resource (usually in the .rc file).
jschroedl