This is the error I got while trying to pack a project in Visual Studio 2013:

PM> NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Service.nuspec -Prop Configuration=Release
Attempting to build package from 'ITVizion.RTVizion.Service.nuspec'.
NuGet : The replacement token 'version' has no value.
At line:1 char:1
+ NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Serv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The replacement...' has no value.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

What's wrong with this?

有帮助吗?

解决方案

I found the problem:

enter image description here

Make sure you fill your project Assembly Information page.

You can access it right clicking your project in Visual Studio Solution Explorer. Select Application tab => Assembly Information... button.

其他提示

In case anyone else has a similar error message, and finds that the error message does not go away even if the information is indeed specified in the Assembly Information, I figured out a fix. I don't see this documented in anyone else's answers, and note that this in fact contradicts what the docs say.

Once you've created SomeProject.nuspec with the various $id$, $author$, etc replacement tokens plus any any custom replacement values, the docs instruct you to then place SomeProject.nuspec** into the same directory as SomeProject.csproj, and run

nuget.exe pack SomeProject.csproj -Build

This did not work for me - I got errors about replacement tokens with no value.

However, what did work for me is to call

nuget.exe pack -Build

in the same directory as the nuspec and csproj files, without specifying which csproj or nuspec file to use. This successfully created the nupkg file with the replacement tokens appropriately substituted based on what I specified in the nuspec!

Hopefully this information will be useful to someone else out there!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top