When I run nuget pack MyProject.csproj
from the command line, I get the following error:
The replacement token 'author' has no value.
I checked my AssemblyInfo, and the AssemblyCompany is specified as "AJ Richardson". I tried manually replacing $author$
with AJ Richardson
in my nuspec file, but then I got a slightly different error:
The replacement token 'description' has no value.
But the AssemblyDescription
is also specified. It seems that NuGet is not reading anything from my AssemblyInfo
. I have verified that AssemblyInfo
is included in my project and the build action is set to Compile.
I have made a couple of NuGet packages before and did not have any issues. The only difference between this package and my previous packages is that this one has dependencies.
For reference, here is my nuspec:
<?xml version="1.0"?>
<package>
<metadata>
<id>$id$</id>
<version>1.0.0</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://github.com/my/repo/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/my/repo</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Initial release.</releaseNotes>
<copyright>Copyright AJ Richardson 2015</copyright>
<tags></tags>
</metadata>
<dependencies>
<dependency id="Newtonsoft.Json" version="6.0.1" />
</dependencies>
</package>
So my question is, why isn't NuGet reading my AssemblyInfo
, and how do I convince it to do that?
I think the problem was that I hadn't built my project since modifying the AssemblyInfo
. I did a rebuild and it's working now.
(As a side note, I also had the <dependencies>
in the wrong section - it should be inside of <metadata>
- but that was not causing the error in my question.)
I was also experiencing issues in this regard; my updates to AssemblyInfo didn't seem to be being picked up - despite me building and rebuilding, etc.
I was able to resolve the issue by explicitly telling NuGet to build (in my case in Release, with pdb symbols):
nuget pack foo.csproj -Build -Symbols -Properties Configuration=Release
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