Integrating revision number with .NET assembly

Patrick Mézard pmezard at gmail.com
Fri Aug 1 15:18:53 CDT 2008


Alexander Gräf a écrit :
>> -----Original Message-----
>> From: Giorgos Keramidas [mailto:keramida at ceid.upatras.gr] 
>> Sent: Friday, August 01, 2008 11:15 AM
>> To: Alexander Gräf
>> Cc: mercurial at selenic.com
>> Subject: Re: Integrating revision number with .NET assembly
>>
>> "hg identify"?
>>
> 
> Thank you for that pointer. I created a simple .js-File:
> 
> Version.js:
> 
> var fso = new ActiveXObject("Scripting.FileSystemObject");
> var shell = new ActiveXObject("WScript.Shell");
> var hgIdentify = shell.Exec("hg identify --num");
> var rev = hgIdentify.StdOut.ReadAll();
> var outFile = fso.CreateTextFile("Version.cs", true);
> outFile.WriteLine("using System.Reflection;");
> outFile.WriteLine("[assembly: AssemblyVersion(\"0.1."+String(rev).replace("\n","").replace("+","")+".*\")]");
> outFile.WriteLine("[assembly: AssemblyFileVersion(\"0.1."+String(rev).replace("\n","").replace("+","")+".0\")]");
> outFile.Close();

If you want to get rid of the '+':

hg id -i -r .

And you can probably get rid of the whole activex dance by writing this in a simple batch file.

--
Patrick Mézard


More information about the Mercurial mailing list