开发者

Can't find a good clean way to increment file version with each release build in vs2010

I have this sample configuration in my assemblyinfo file.

// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.0.*")]
[assembly: AssemblyFileVersion("3.1.0.0")]

Once I rebuild, I get this:

Fileversion:开发者_开发百科 3.1.0.0 Product version: 3.1.0.0

What I would like is the product version to be static, this is already fine, but I would like the file version to automatically increment, is this possible?

Assembly version is good for technical analysis, but file version is an NTFS property visible by right clicking the file in windows explorer, so customers and consultants can get an idea of the version without using a 3rd party tool.


Annoyingly (however probably on purpose) the * in the assembly version attributes only works if applied to the last two, not just the final one:

[assembly: AssemblyVersion("3.1.*")]
// [assembly: AssemblyFileVersion("3.1.*")] - I take it back, this doesn't work.

If you want to increment the revision number without breaking .Net references then I suggest that you use the assembly file version rather than the assembly version, and increment the assembly version manually whenever you decide its necessary.

The only alternative would be a 3rd party add-in or external process.

(It seems that I was wrong - the * syntax only works on the assembly version not the file assembly version.)


Looks like someone had the same issue, and the resolution is to comment out the 'AssemblyFileVersion' attribute, and it will take the value of the 'AssemblyVersion' which should work for you.

Assembly File Version not changing?
Assembly File Version not changing?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜