I'm packaging up a bunch of javascript for a website. Here's what my .nuspec
looks like.
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<version>$version$</version>
<authors>Author Person</authors>
<owners>Company Name</owners>
<id>PackageNameId</id>
<title>PackageNameId</title>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description text stuff</description>
<copyright>Company Copyright Info</copyright>
</metadata>
<files>
<file src="www\**" target="" /> <!--It just packages everything in the www folder in the same directory as this .nuspec -->
</files>
</package>
It just packages everything in that www folder. The $version$
token should be getting replaced by the NugetPackage version flag in TFS (what I'm building in).
I don't see anything called value
, so I'm really at a loss for why it's throwing an error.
Here's the full error:
Attempting to build package from 'PackageName.nuspec'.
##[error]Value cannot be null or an empty string.
##[error]Parameter name: value
I suspect you're getting this error running nuget pack
on your nuspec
file instead of your csproj
file.
As I learned from this open NuGet issue, AssemblyInfo token replacement (e.g. <version>$version$</version>
) only works if you're calling nuget pack
on your .csproj or .vbproj file. Quoting from NuGet documentation:
Using the project file directly is necessary for token replacement because the project is the source of the token values. Token replacement does not happen if you use nuget pack with a .nuspec file.
I took an existing package that I am using and removed the version (e.g. <version></version>
). The error I got when I tried to run nuget pack mypackage.nuspec:
Attempting to build package from 'mypackage.nuspec'.
Value cannot be null or an empty string.
Parameter name: value
There are 4 required values for a nuspec file:
Since you are getting this error, I would guess that whatever your $version$ token is not being passed appropriately or used correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With