Can I automatically increment the file build version when using Visual Studio?

后端 未结 25 2529
-上瘾入骨i
-上瘾入骨i 2020-11-22 14:32

I was just wondering how I could automatically increment the build (and version?) of my files using Visual Studio (2005).

If I look up the properties of sa

25条回答
  •  心在旅途
    2020-11-22 15:13

    To get the version numbers try

     System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
     System.Reflection.AssemblyName assemblyName = assembly.GetName();
     Version version = assemblyName.Version;
    

    To set the version number, create/edit AssemblyInfo.cs

     [assembly: AssemblyVersion("1.0.*")]
     [assembly: AssemblyFileVersion("1.0.*")]
    

    Also as a side note, the third number is the number of days since 2/1/2000 and the fourth number is half of the amount of total seconds in the day. So if you compile at midnight it should be zero.

提交回复
热议问题