nuspec and csproj package version tags

和自甴很熟 提交于 2019-11-29 17:44:49

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!