I have a new ASP/.NET Core project that I publish to NuGet. What\'s the recommended approach to keep the version tags in x.csproj
and x.nuspec
in
With new .csproj
format, you can add all of the information to generate NuGet packages in the .csproj
file. There is no longer a reason to use a .nuspec
file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>My NuGet Project</AssemblyTitle>
<Description>Something I decided to release on NuGet.</Description>
<PackageTags>my;project;whatever;</PackageTags>
<Authors>Me (who else)</Authors>
<RepositoryUrl>https://github.com/theprojectname</RepositoryUrl>
<PackageLicenseUrl>https://github.com/theprojectname/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageProjectUrl>http://myproject.org/</PackageProjectUrl>
<PackageIconUrl>https://github.com/theprojectname/blob/master/branding/logo/icon-128x128.png?raw=true</PackageIconUrl>
<Copyright>Copyright © 2006 - 2018 Me</Copyright>
</PropertyGroup>
...
</Project>
Some of the elements (such as <PackageId>
) default to using settings from the rest of the project file, so you don't need to add them unless you need them to be different than the defaults.
Note you must use dotnet pack (rather than the old NuGet.exe CLI) or Visual Studio 2017 in order to utilize this feature.