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.
For me unblocking nuget.exe did the trick. As of NuGet 5.7 this seems to be necessary.
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.
There's actually almost nothing wrong with the command.
It is not possible to do what the question asks without some prerequisites.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With