Is it possible to add a description for the NuGet package being added in the Azure DevOps Pipeline?
问题:
回答1:
Nuget package description in the Azure DevOps Nuget pipeline step
As we know, when we pack the nuget package with .csproj
file, nuget will get the package info from the file AssemblyInfo.cs
in the project, like assembly: AssemblyVersion
, assembly: AssemblyDescription
and so on.
So, to add a description for the NuGet package, we could add the description for assembly: AssemblyDescription
in the AssemblyInfo.cs
:
[assembly: AssemblyDescription("This is Test Decription!!!")]
Then push this update in to the Azure DevOps repos, in this case, we could pack the package with that description.
Besides, if you want use the .nuspec
file, we need create this file on local machine with the command line nuget spec "..\*.csproj"
, then modify the <description>$description$</description>
in the .nuspec
, upload this file to the repos.
Check the document Creating NuGet packages to create the .nuspec
file.
Hope this helps.
回答2:
Yes, it's possible. Expand the "Advanced", then in the "Additional build properties" specify the value you want in this way:
Description="value"
It works only if you pack a .nuspec
file or .csproj
& check-in/push the .nuspec
, and in the nuspec there is token for this:
<description>$description$</description>
EDIT:
According to your comment you pack the .csproj
file, so you need to create the .nuspec
file.
How? go to the .csproj
folder and open there CMD, run the following command:
nuget spec
Now commit & push (or check-in) the file.
Of course, you can open the .nuspec
and edit the <description>
section and then commit & push and to your NuGet package will be description or edit the AssemblyInfo, but if you want to do it during the build you can do it with my example above.