Package version is always 1.0.0 with dotnet pack

后端 未结 3 1568
小鲜肉
小鲜肉 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 06:11

    Better yet, specify /p:Version=$(Build.BuildNumber) (TFS/VSTS) on the dotnet pack command and it will build it with the specified version in the nuget package. Example (non TFS specific):

    dotnet pack .\src\example\example.csproj -o c:\published\example -c Release /p:Version=1.2.3
    

    Example (TFS specific) <- we use this for our TFS 2017 packing using a powershell script step.

    dotnet pack $(Build.SourcesDirectory)\src\example\example.csproj -o $(Build.ArtifactStagingDirectory)\Pack -c Release /p:Version=$(Build.BuildNumber)
    

    Note: It does not update package reference versions.

提交回复
热议问题