LorneCash
LorneCash

Reputation: 1594

VSTS Automated Build NuGet Packager/Publisher

My package builds successfully and is uploaded to the Packages feed in VSTS however I can't seem to figure out how to edit the Description and Author of the package so that my set values show in the Package feed.

From what I read I put my content in the NuGet Packager under additional build properties and when I look at the log file I see this:

...NuGet.exe pack "...csproj" -OutputDirectory "..." -Properties Configuration=release;Description="My Description";Authors="Me";Owners="My Company"

From the documentation I believe I did this right(but clearly I did not). It does seem a bit confusing as to what goes in "Additional build properties" vs NuGet Arguments.

Again my goal is get the Description and Author that I set to be viewable from the NuGet Package Manager within Visual Studio.

Upvotes: 2

Views: 942

Answers (2)

LorneCash
LorneCash

Reputation: 1594

If it's building the package then there are no problems with your NuGet Packager build step. Two things need to change though.

  1. In order to specify properties like you are doing there MUST be a tokenized *.nuspec file in the same directory as the solution file with the same name and of course the *.nuspec file needs to be checked in to VSTS/TFS.
  2. The token name for description can't be Description.

For more details on the *.nuspec file please see the solution here:

Nuget.exe pack WARNING: Description was not specified. Using 'Description'

Upvotes: 1

starian chen-MSFT
starian chen-MSFT

Reputation: 33698

You could create a package according to the .nuspec file. Steps:

  1. Generate .nuspec file for your project (command: nugget spec).

For example: (Include author and description token)

<?xml version="1.0"?>
<package >
  <metadata>
    <id>CommLib1</id>
    <version>1.0.0.6</version>
    <title>CommLib1</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>
  1. Include this file to source control
  2. Specify Nuget Arguments (token in step 1) of Nuget Packager build step enter image description here

Update1:

In general, you just need to update AssemblyInfo.cs file of your project (Author=>AssemblyCompany; Description=>AssemblyDescription; Version=>AssemblyVersion), it creates package according to this data unless it can't retrieve metadata from your assembly (I have a project has this issue).

So, steps:

  1. Make sure nuget could retrieve necessary metadata by creating package through nuget.exe command directly in your local/build machine (nuget pack [XX].csproj)

  2. Create a build definition (1. Visual Studio Build 2. Nuget Packager with default value 3. Nuget Publisher)

Upvotes: 3

Related Questions