简体   繁体   中英

How to automate Assembly File Version in C#

Assembly version can be auto-incremented by specifying it as "1.0.*", which automatically determines build and revision number. But in case somebody wants their File version to be the same as the Assembly version, for consistency or other reasons, how can that be achieved without typing it by hand every time? The "1.0.*" method does not work for AssemblyFileVersion.

In Properties/AssemblyInfo.cs, just comment out the last line

[assembly: AssemblyFileVersion("1.0.0.0")]

so the end of the file reads

// 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("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

That way the Assembly version number will automatically be assigned as File version as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM