The replacement token 'description' has no value——a little cute error about NuGet

2947 단어

At first ,let me introduce the most powerful tool for developers,NuGet!


What is NuGet?


  NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.
common command for NuGet .
  1、NuGet setApiKey xxxxx-xxxx-xxx-xxxx-xxxx-xxxx (for:setAPIKey of your NuGet count)
  2、NuGet spec (for: create a xxxx.nuspec file)
  3、NuGet  pack  xxxxxx.csproj (for: create a xxxx.nupkg file)
  4、NuGet push xxxxx.nupkg (for: push the nupkg on your NuGetServer ,then your can published your package,and download them from the nuget store)
  today ,i catched the error which is show the message "The replacement token 'description' has no value ". what could trigger thisissue ? wowo, that's so so sinple. you just need know the relationship between the xxx.nuspec file and the  xxxx.csproj file.
  The $description$ value is replaced by AssemblyDescription's value in AssemblyInfo.cs.The project needs to be built before creating the package however.
  How should we know this totally? en hen, OK,let' meet the hole nuspec file
<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
    <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2016</copyright>
    <tags>Tag1 Tag2</tags>
  </metadata>
</package>

  here ,those variables gonna replaced  by values which came from your Properties\AssemblyInfo.cs file, it 's decide by the config in your
Properties\AssemblyInfo.cs file. Let's watch the entire file
   so, did you noticed the flag? that's the reason why we'll met the error  "The replacement token 'description' has no value"here .
How to solve this problem?
   that's easy ! just fill in the blank in your Properties\AssemblyInfo.cs file , and then thexxx.nuspec file can get the value which come from yourProperties\AssemblyInfo.cs file.
   Note : there is no need to moddify thexxxx.nuspec file. Just let it run automaticly . To be a lazy man  haha!

좋은 웹페이지 즐겨찾기