GitVersion/Octopack not supporting SemVer 2.0

Hi,

i am trying to create a new version of the package we are using, implementing OctoPack 3.0.71 to build the nuget package and GitVersion to modify the AssemblyVersion file to something like:
MSBUILD : OctoPack error OCTONUGET: ‘0.1.0-origin-Gitversion.1+1626.Branch.origin/Gitversion.Sha.3c4d004b102fc165f620e322c134cfc4e97cf0d9’ is not a valid version string.
MSBUILD : OctoPack error OCT-1676060969: There was an error calling NuGet. Please see the output above for more details. Command line: ‘D:\jenkins\workspace\GitVersion\app\packages\OctoPack.3.0.71\tools\NuGet.exe’ pack “D:\jenkins\workspace\GitVersion\app\XXXXX.XXX.Ui\obj\octopacking\XXXXXX.XXX.Ui.nuspec” -NoPackageAnalysis -BasePath “D:\jenkins\workspace\GitVersion\app\XXXXX.XXX.Ui” -OutputDirectory “D:\jenkins\workspace\GitVersion\app\XXXXX.XXX.Ui\obj\octopacked” -Version 0.1.0-origin-Gitversion.1+1626.Branch.origin/Gitversion.Sha.3c4d004b102fc165f620e322c134cfc4e97cf0d9 [D:\jenkins\workspace\GitVersion\app\XXXXX.XXX.Ui\Jupiter.Web.Ui.csproj] (edited the package name at the Client’s request)
Apperently, the nuget.exe used to build the package is not supporting SemVer 2.0

Is Octopack 3.4.7 using a newer nuget.exe?
From here: https://github.com/NuGet/Home/issues/1359, it appears that “NuGet.Core 2.14.0-rtm-832 is now available on nuget.org with support for SemVer 2.0.0. Using this with NuGet.Server will give support for private feeds that support SemVer 2.0.0.”

Can you help me out and solve this?

Thanks.

Hi Alex,

Thanks for getting in touch! The latest Octopack version uses NuGet 3.4.3.

The problem appears to be that the / character (in origin/Gitversion) is not valid in the metadata portion of the version. From memory the solution is to ensure have checked out a local, not remote branch. Check how your build server does it’s git retrieval and checkout.

Hope that helps!

Robert W

I am afraid that is not correct, Robert.

Origin/GitVersion is a branch from the master branch. And it’s taking the code from that branch.

Also, which might be confusing, is that the Jenkins project is called the same.

Meanwhile, I have upgraded octopack from 3.0.71 to 3.4.7 and I no longer receive the below error. I believe that Octopack 3.4.7 uses Nuget.exe 3.5 (btw, I had issues seeing documentation for Octopack)

I am now struggling to get GitVersionTask to make me a correct version like Package.0.1.0-origin-Gitversion.1.

Thanks.

“The problem appears to be that the / character (in origin/Gitversion)” - removed origin/ from the branch name and left GitVersion branch there.

I now have the version Package.0.0.0.0.nupkg

Hi Alex,

Yeh, as you probably noticed the version generated 0.1.0-origin-Gitversion.1+1626.Branch.origin/Gitversion.Sha.3c4d004b102fc165f620e322c134cfc4e97cf0d9 had the / in it.

Usually your local branches should not have origin/ in it. ie the remote branch is origin/Gitversion and the local is Gitversion I’d expect a package name like Package.0.1.0-origin-Gitversion.1

If memory serves, depending on your git versioning strategy chosen, you need to have a tag on the master branch with the starting version. We also put a gitversion.yml file into the root of the project.

Hope that helps. I’m unsure from your response whether you ended up with the result you wanted, but if we can help further with OctoPack, please let me know.

Regards,

Robert W