Setting the version number for .NET Core projects - CSPROJ - not JSON projects

前端 未结 10 882
一个人的身影
一个人的身影 2020-12-02 08:58

This question is very similar to Setting the version number for .NET Core projects, but not the same. Using the latest stable version of .NET Core at the time of writing (1.

相关标签:
10条回答
  • 2020-12-02 09:48
    dotnet build /p:AssemblyVersion=1.2.3.4
    

    Does that work for you?

    0 讨论(0)
  • 2020-12-02 09:48

    Passing /p:PropertyName=Value as arguments does not work for me (ASP.Net Core 2.0 Web App). I found the Manifest Versioning Build Tasks on marketpace: https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-Versioning-Task

    0 讨论(0)
  • 2020-12-02 09:51

    In my case, the main key was /property:Version=1.2.3.4. And the following command line did the job:

    dotnet build SolutionName.sln -c Release /property:Version=1.2.3.4
    

    This will override Assembly default version.

    0 讨论(0)
  • 2020-12-02 09:52

    To answer your question straight: The new SDK for msbuild is auto generating an assembly info file. You can suppress that using msbuild directives (to see the it by sample: invoke dotnet migrate on a project.json based project).

    But let me tell you my handling: I had multiple projects sharing the same version. I added a version.props file which contained a property group including a item named VersionPrefix. This file I included via the csproj file (Include statement). I also removed all AssemblyInfo.cs files and let the SDK generate them for me.

    I modify the version.props file during build.

    0 讨论(0)
提交回复
热议问题