Package version is always 1.0.0 with dotnet pack

Package version is always 1.0.0 with dotnet pack

https://github.com/kerryjiang/SuperSocket/blob/master/Directory.Build.props

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:

<PropertyGroup>
  <VersionPrefix>1.0.0</VersionPrefix>
  <VersionSuffix>alpha</VersionSuffix>
</PropertyGroup>

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

<PropertyGroup>
  <Version>1.0.0-alpha</Version>
</PropertyGroup>
原文地址:https://www.cnblogs.com/chucklu/p/13076079.html