Package version is always 1.0.0 with dotnet pack

后端 未结 3 1576
小鲜肉
小鲜肉 2021-02-02 05:31

TLDR: Where is dotnet pack pulling the version information when it creates the nuget package for an assembly?

I have a library, that I had transitioned fr

3条回答
  •  春和景丽
    2021-02-02 05:55

    When you use dotnet pack, the version is pulled from the project definition (previously project.json, now *.csproj), not AssemblyInfo.cs. So, your new workflow will be very similar to what it was with project.json.

    From the project.json to csproj migration docs, you can use the VersionPrefix and VersionSuffix properties.

    Before:

    {
      "version": "1.0.0-alpha-*"
    }
    

    Now:

    
      1.0.0
      alpha
    
    

    You can also use the single Version property, but the docs warn that this "may override version settings during packaging".

    
      1.0.0-alpha
    
    

提交回复
热议问题