nuspec and csproj package version tags

前端 未结 1 729
天涯浪人
天涯浪人 2020-12-22 07:13

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

相关标签:
1条回答
  • 2020-12-22 08:00

    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.

    0 讨论(0)
提交回复
热议问题