Search code examples
c#tfsbuildnuget-packagetfs-2015

TFS 2015 Build Task - NuGet Packager


I am currently setting up a build definition to package a NuGet. Here is my current build task. It is executed after the solution successfully builds.

enter image description here

I am using a nuspec file to decide what information the package will display. My nuspec file contains references to the information (i.e. pulled from the assemblyinfo.cs file).

enter image description here

Running the build definition I receive the following error.

![enter image description here

Are the replacement tokens not supported within TFS 2015 under the Package NuGet task?


Solution

  • The packager does not replace tokens in the .nuspec file (except the <version/> element). You must supply values for elements such as <id/> and <description/>. The most common way to do this is to hardcode the values in the .nuspec file.

    Source Link: Pack NuGet packages

    When using token replacement, make sure your are trying to nuget pack the csproj file, not the nuspec file

    nuget pack myproject.csproj -IncludeReferencedProjects -Prop Configuration=Release
    

    The nuspec is picked up automatically when given the same name as the csproj file.

    Please refer this similar question: nuget: "The replacement token 'id' has no value"