Specify publish version with MSBuild command line as assembly version of project

后端 未结 3 1135
无人共我
无人共我 2021-02-07 18:52

I have a simple batch file that I\'m running from a DOS command line that is used for building a small C# application that publishes a ClickOnce project. One line is this:

3条回答
  •  清歌不尽
    2021-02-07 19:22

    Try adding this to your .csproj file. The target will retrieve the version from the output assembly and update the ApplicationVersion before the Publish:

    
      
        
      
      
        %(fooAssemblyInfo.Version)
      
    
    

    There's probably a nicer way to dynamically get the assembly name but for your purpose it should do the trick.

    Credit to this answer for the GetAssemblyIdentity syntax: https://stackoverflow.com/a/443364/266882

    Questioner Edit:

    See comment below for update.

提交回复
热议问题