How to synchronise the publish version to the assembly version in a .NET ClickOnce application?

后端 未结 5 1416
甜味超标
甜味超标 2020-12-14 01:10

In my C# ClickOnce application, there is an auto-incremented publish version in the Project -> Properties -> Publish tab. I\'d like to display that version

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 01:41

    I did it the other way around, used a wildcard for my assembly version - 1.0.* - so Visual Studio/MSBuild generated a version number automatically:

    // AssemblyInfo.cs    
    [assembly: AssemblyVersion("1.0.*")]
    

    And then I added the following AfterCompile target to the ClickOnce project to assign synchronize PublishVersion with the assembly version:

    
        
          
        
        
          %(TargetAssemblyIdentity.Version)
        
    
    

提交回复
热议问题