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

后端 未结 25 2852
-上瘾入骨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:15

    Another option for changing version numbers in each build is to use the Version task of MSBuild.Community.Tasks. Just download their installer, install it, then adapt the following code and paste it after in your .csproj file:

    
    
        
          
          
          
          
        
        
    
    

    Note: Adapt the StartDate property to your locale. It currently does not use the invariant culture.

    For the third build on January 14th, 2010, this creates a VersionInfo.cs with this content:

    [assembly: AssemblyVersion("1.0")]
    [assembly: AssemblyFileVersion("1.0.14.2")]
    

    This file then has to be added to the project (via Add existing item), and the AssemblyVersion and AssemblyFileVersion lines have to be removed from AssemblyInfo.cs.

    The different algorithms for changing the version components are described in $(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.chm and Version Properties.

提交回复
热议问题