c# - How do I automatically set assembly version during nightly build? -


we have nightly build process automatically versions c++ projecs. here's how works. there's common header file versionnumber.h has specific #define version number. nighly build checks file out, increments integer behind #define , checks in. visual c++ projects #include header resource files , use define specifying version (version smth 1.0.3.thatnumber).

so far good. i'd have same c# class libraries built in same daily build. have

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

in assemblyinfo.cs files , libraries end 1.0.horriblenumber.anotherhorriblenumber version , 2 numbers don't correlate number used c++ projects.

how have same determenistic automatic version numbering in c# projects minimal effort?

firstly can specify full version follows:

[assembly: assemblyversion("1.0.9.10")] 

secondly, common approach make little more straightforward (and echoes c++ approach) have single version.cs file (name unimportant) sits in common location has version attributes in it. can add file link cs projects, remembering remove version attributes assemblyinfo.cs files. in way have single file update (before running build). can put other common assembly attributes in version.cs file such as: neutralresourceslanguage or clscompliant.

if not use single "version.cs" approach, can work recursively through source code directory structure, , update assemblyinfo files individually (before running build).

it may not relevant you, version numbers (in assemblyversion) have maximum range of 16bit. have seen become issue dates have been used these numbers. if wish have more latitude assemblyfileversion not have these restriction, purely informational purposes in .net, rather part of assembly's identity. common set assemblyversion , assemblyfileversion same values tools display combinations of these.

see following more on assemblyversion vs assemblyfileversion:

what differences between assemblyversion, assemblyfileversion , assemblyinformationalversion?


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -