Package version is always 1.0.0 with dotnet pack

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)