VSTS Build - The replacement token 'version

2019-03-02 06:22发布

问题:

I have setup my very first Build definition in Visual Studio Team Services (was Visual Studio Online).

It builds, all tests pass and then it finally pops this error:

Attempting to build package from 'EvoqPortaCoreDistrib.nuspec'. The replacement token 'version' has no value. Unexpected exit code 1 returned from tool NuGet.exe

This is after clearing some other problems it found with my nuspec file. Though oddly enough, I've used this nuspec to push packages manually from my desktop PC to a feed hosted somewhere else. The difference being that I've updated to NuGet 3.3 today.

So its saying that there's no assembly version? Which is frankly, impossible.

回答1:

Hang on. Apparently, when you supply your own .nuspec file, the VSO build goes all dumb.

https://msdn.microsoft.com/en-us/Library/vs/alm/Build/steps/package/nuget-packager

The packager does not compile the .csproj files for packaging. Each project is packaged only if it has a .nuspec file checked in. The packager does not replace tokens in the .nuspec file (except the element, see Use build number to version package, below). You must supply values for elements such as and . The most common way to do this is to hardcode the values in the .nuspec file.

So I'll take out my .nuspec file.