Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

nuget

I'm trying to create a NuGet Package via command line and I can't seem to figure out how to set Description, Author, Title, Summary, releaseNotes, and Owner. The package creates successfully it just gives me this warning:

WARNING: Description was not specified. Using 'Description'.
WARNING: Author was not specified. Using 'User'.

Here's my command:

NuGet.exe pack "<MyProjectPath>.csproj" -OutputDirectory "<MyOutputDirectory>" -Properties Configuration=release;Description="MyDescription";Authors="MeMeMe...MeToo";Title="MyTitle";Summary="MySummary";releaseNotes="MyChanges;"Owners="MyCompany"

I'm not sure if this matters but I'm using the NuGet.exe that came from the "CredentialProviderBundle.zip" file downloaded from Visual Studio Team Services.

like image 799
LorneCash Avatar asked Nov 13 '16 05:11

LorneCash


3 Answers

For me unblocking nuget.exe did the trick. As of NuGet 5.7 this seems to be necessary.

Unblock nuget.exe

like image 114
Matthias Schuchardt Avatar answered Nov 20 '22 14:11

Matthias Schuchardt


In case this helps someone else, a stupid reason for getting a "Description is required" error: I had not rebuilt my project since I added a description to my AssemblyInfo.

I'd defined a nuspec file in my project directory with a <description>$description$</description> token. When I ran

nuget pack MyProject.csproj

I saw a "Description is required" error, even though my AssemblyInfo contained [assembly: AssemblyDescription("A DESCRIPTION.")]...

... because although you pack the .csproj, it is your most recent build that is actually packaged by Nuget. d'oh.

like image 13
tessafyi Avatar answered Nov 20 '22 12:11

tessafyi


There's actually almost nothing wrong with the command.

It is not possible to do what the question asks without some prerequisites.

  1. There must be a *.nuspec file in the same directory as the *.csproj with the same exact name.
  2. The *.nuspec file must contain all the elements you are trying to set via command line
  3. All elements that will be populated via command line must contain a token in the form "$tokenName$"
  4. In the command line you must not specify the *.nuspec element name but rather the value contained between the dollar signs (AKA the token name)
  5. The token name may be the same as the element name for all the properties listed in the question with the exception of the Description element. The Description element's token must NOT be named "Description". "Desc" works perfectly fine here. (This is why I said ALMOST nothing wrong with the command listed in the question)

Here's an example of a *.nuspec file for this specific example:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
    <metadata>
        <id>$Id$</id>
        <version>$Version$</version>
        <title>$Title$</title>
        <authors>$Authors$</authors>
        <owners>$Owners$</owners>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>$Desc$</description>
        <summary>$Summary$</summary>
        <releaseNotes>$ReleaseNotes$</releaseNotes>
        <copyright>Copyright ©  2016</copyright>
        <dependencies />
    </metadata>
</package>

The Id and Version don't need to have tokens because they will automatically be overwritten either way, but it doesn't hurt.

Here's the command line you should use with the *.nuspec file as specified above:

NuGet.exe pack "<MyProjectPath>.csproj" -OutputDirectory "<MyOutputDirectory>" -Properties Configuration=release;Desc="MyDescription";Authors="MeMeMe...MeToo";Title="MyTitle";Summary="MySummary";ReleaseNotes="MyChanges;"Owners="MyCompany"
like image 12
LorneCash Avatar answered Nov 20 '22 14:11

LorneCash