Wednesday 22 April 2015

The replacement token 'id' has no value

When trying to manually build a NuGet package from the command line with the following command

nuget pack Trial.nuspec

You may recieve the following error:
Attempting to build package from 'Trial.nuspec'.
The replacement token 'id' has no value.
This will be likely if you are using tokens in the nuspec file. Example:
<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <licenseUrl>http://localhost</licenseUrl>
    <projectUrl>http://localhost</projectUrl>
    <iconUrl>http://locahost</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Initial release.</releaseNotes>
    <copyright>Copyright 2015</copyright>
    <tags></tags>
  </metadata>
  <files>
    <file src="bin\$configuration$\*" target="" />
  </files>
</package>

If this is the case, run the same command prompt but pass in the csproj file instead.

nuget pack Trial.csproj

No comments: