2
votes

I am trying to create a prerelease build for a .net-standard 2.0 library in VSTS. I have created a build with the following steps

  1. dotnet restore version 2
  2. dotnet build version 2
  3. dotnet pack version 2
  4. nuget push version 2

When I use the environment variable (PackageName) as $(Build.BuildNumber)-beta as my pack version. The pack fails with the error BuildName_2018.7.11.1-beta is not a valid version string. I have previously used this environment variable as my pack version in .net-framework builds with success.

2

2 Answers

4
votes

The version does not meet Nuget Package Version format. It must start with numbers like following:

1.0.1

6.11.1231

4.3.1-rc

2.2.44-beta1

So you need to remove the strings in your build number format. Refer to this link for details: Package versioning.

1
votes

That's because the string $(Build.BuildNumber)-beta is not an environment variable.

You can try to create a variable e.g $(packversion) and set the string $(Build.BuildNumber)-beta as the value of that variable, then use the environment variable $(packversion) in dotnet pack task.


UPDATE:

Seems it can only identify the string which end with number as the version string.

So, just try adding the "beta" as prefix like this Beta-$(Build.BuildNumber), then check if that works.

enter image description here