简体   繁体   中英

How to specify Nuget Package Id with Asp.net 5 (dnu pack)

Is it possible to specify a setting in the project.json file that will make the dnu pack command produce a NuGet package with a different name than the name of the project that was packed?

Basically we had to shorten our project names for publishing reasons and would like to make the package names be the fully qualified namespace.

I believe this is the equivalent of setting the Id field in a .nuspec .

In your Properties/AssemblyInfo.cs file, you can override some of the properties in the .nuspec , which will actually force it to import tokens from AssemblyInfo.cs instead.

In this case, you're interested in the AssemblyTitle CLR attribute:

[assembly: AssemblyTitle("ShortPackageName")]
...

Then after you generate your .nuspec, it should look like this with a placeholder:

<metadata>
  <id>$id$</id>

EDIT :

Okay, it looks like dnu pack ignores .nuspec and reads from project.json instead. In that file, add this:

"description": "ShortPackageName",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM