Search code examples
nuget

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


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.


Solution

  • 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"