37

Trying to create and publish a NuGet package from a project (*.csproj) via NuGet.exe and I got the following warning:

The replacement token 'description' has no value.

How can I get rid of this warning?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Rubens Mariuzzo
  • 28,358
  • 27
  • 121
  • 148

6 Answers6

37

This warning appear when the Visual Studio project was not built before packaging using NuGet. Just rebuild your project and repack.

  1. Go to Build then Rebuild.
  2. From command prompt: nuget pack your-project.csproj.

Then it should work.

Note this behavior was filed as an issue in CodePlex.

Note: as per Boris Callens' response below, can use the -Build to have NuGet do the build

Boris Callens
  • 90,659
  • 85
  • 207
  • 305
Rubens Mariuzzo
  • 28,358
  • 27
  • 121
  • 148
  • 2
    had this problem, rebuild didn't work because i was building 'debug' and nupack-ing 'release'... – Menahem Oct 21 '13 at 07:37
  • 2
    My issue was related to this one: https://nuget.codeplex.com/discussions/262324 It was defaulting to Debug configuration and the following command solved my problem: NuGet.exe pack Foo.csproj -Prop Configuration=Release – Daniel Lobo Mar 23 '14 at 12:45
27

Ensure you defined the assembly description in your Properties\AssemblyInfo.cs file for the project you are targeting when calling nuget.exe pack *.csproj.

[assembly: AssemblyDescription("Here goes the NuSpec $description$ token.")]

Also check the NuGet docs on tokenized NuGet manifests for more info: http://docs.nuget.org/docs/reference/nuspec-reference#Replacement_Tokens

Xavier Decoster
  • 14,580
  • 5
  • 35
  • 46
  • 3
    Lovely! This is really the answer to the question. Adding your post about $version$ as well - for reference: http://www.xavierdecoster.com/post/2012/04/26/nuget-version-token-explained – Sudhanshu Mishra Mar 08 '16 at 05:51
5

The $description$ value is replaced by AssemblyDescription's value in AssemblyInfo.cs. The project needs to be built before creating the package however. To have nuget do this for you you can use the -build flag

path:\to\project\nuget.exe [project.csproj] -build
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
5

I have similar problem on "The replacement token 'author' has no value". I use nuget pack projectfilename.csproj -Build and problem is solved, hope it helps

learningBunny
  • 69
  • 1
  • 3
1

My builds are specific to x86 or x64 which puts the dlls in different bin subdirectories. It is expecting the dll to be in the default directory which is for "Any CPU". I'm not sure if you can change where it looks, but I just changed my release to Any CPU so that it would work.

Papa Burgundy
  • 6,397
  • 6
  • 42
  • 48
1

Also, make sure you pass your projectName.csproj file and NOT the projectName.nuspec file. This is the corect way:

nuget pack projectName.csproj
mihai
  • 4,592
  • 3
  • 29
  • 42