'Azure DevOps "NuGet pack" task ignores/overwrites package metadata
I have setup a simple CI pipeline in Azure DevOps for building a .NET5 NuGet package, which looks like this
The pipeline is able to successfully pack and release the project as intended, but when I go to inspect the NuGet package, I find that all of the package metadata is missing (except for the version, which is correct, and the author(s), which is incorrectly showing the name of the ADO build agent as the author). I currently have all of the package metadata located in the .csproj file.
A screenshot showing the incorrect metadata, which is also what is shown when I look at the .nuspec in the NuGet package that is generated by the pipeline. Of course, when I pack the project on my local machine, all of the metadata generates the way it should.
I've seen one other post similar to this where the author switched the pipeline to use dotnet tasks instead of MSBuild tasks. Unfortunately, this is not an option for me, as this project has COM references that are not supported by the dotnet CLI, so MSBuild is my only option.
Does anyone know why the 'NuGet pack' task in my pipeline is not using the metadata in my .csproj file?
Solution 1:[1]
Does anyone know why the 'NuGet pack' task in my pipeline is not using the metadata in my .csproj file?
According to the document Create a NuGet package using MSBuild:
The command that creates a package,
msbuild -t:pack, is functionally equivalent todotnet pack.
Or you could add below argument in the .csproj file, which will create the package when you build the project with VS build task:
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Leo Liu-MSFT |




