I have a Class Library project using .net Framework 4.6.1 and I am building a NuGet package using Azure Pipelines. I have got most of the fields in the NuGet package properties populated however I'm struggling with a few.
I'm using an extension to read the AssemblyVersion from AssemblyInfo.cs
and use this for the versioning.
I can also see that it extracts the below fields form AssemblyInfo.cs
AssemblyInfo.cs Field | NuGet Package Property |
---|---|
AssemblyTitle | Title |
AssemblyDescription | Description |
AssemblyCompany | Authors |
AssemblyProduct | ID |
AssemblyCopyright | Copyright |
The NuGet fields I'm trying to populate are Release Notes, Summary & Owners but I'm not sure where to start. I've look at what other fields I can use in AssemblyInfo and none of them sound like they would relate to the mentioned fields. I've also looked in the NuGet Pack task in Azure Pipelines but theres no mention of these fields either
When we pack the nuget package with .csproj
file, nuget will get the package info from the AssemblyInfo.cs
file in the project. (eg: AssemblyVersion
, AssemblyDescription
, AssemblyCopyright
etc).
We can see this information in the package overview page after it's published to a feed.
I'm trying to populate are Release Notes, Summary & Owners
Here is the direction for your reference. We can try to add this as a description for the NuGet package, we could add the description for assembly: AssemblyDescription
in the AssemblyInfo.cs
:
[assembly: AssemblyDescription("Release Notes, Summary & Owners here")]
However, we need to find a way to generate the required information ( Release Notes, Summary, ect
) and write it to the AssemblyInfo.cs
file.
Another way is using the .nuspec
file. We need to 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. Please see Create the.nuspec file for details.
After that, we can expand the " Advanced
" option of the NuGet Pack task, then in the " Additional build properties
" specify the value you want in this way:
Description="ReleaseNotesHere"
With this way, the specified value will replace description.
Specifies a list of token=value pairs, separated by semicolons, where each occurrence of $token$ in the.nuspec file will be replaced with the given value. Values can be strings in quotation marks.
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.