asp.netvisual-studionuget-packagenuget-spec

NuGet spec command ignoring metadata from project properties


I am generating a NuGet package of a library in .NET Standard 2.0 using Visual Studio 2022.

I go to Project properties and edit the project information as shown in the pictures.

Project Properties 1

Project Properties 2

Project Properties 3

When i use the command NuGet specto generate the manifest, the values are not corresponding to the project metadata edited in Visual Studio.

NuSpec file

I tried several solution found on web but none worked, even unloading the project, reloading and cleaning it. It looks like nuspec is ignoring the properties of the project.

I know I can edit the metadata by hand, but I am wondering why this happens. If I make several rebuild of the package I have to edit manually the entire spec file each time.


Solution

  • I have found out that there is no need to call NuGet spec and follow the manual procedure in order to create a package in Visual Studio 2022.

    In Visual Studio 2022, it is enough to right-click the project and select Properties. Then in the Package section, check the box Produce a package on build.

    A NuGet package of the project, using the metadata provided in the project properties, will be created in the bin/Debug or 'bin/Release` folder. The folder depends on your building choices.

    enter image description here