在 JetBrains Rider 中配置 .nupkg 版本和其他元数据

Configure .nupkg version and other metadata in JetBrains Rider

我整天都在想弄清楚 JetBrains 的 Rider 是如何设置 .nupkg 版本和其他元数据的。

我似乎找不到任何配置 window 总体上 IDE 来执行此操作,或者如果我必须有一个包含项目数据的特殊文件。

每当我将 Rider 用于 "Pack Solution" 或 "Pack Selected Projects" 时,.nupkg 数据始终默认为以下内容(其中 MyProjectName 是我的项目名称):

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>MyProjectName</id>
    <version>1.0.0</version>
    <authors>MyProjectName</authors>
    <owners>MyProjectName</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package Description</description>
    <dependencies>
      ...
    </dependencies>
  </metadata>
</package>

我查看了 Microsoft's Docs for Packages and JetBrains Rider Help,但是 none 给了我任何关于必须做什么的提示。

我在 Ubuntu 14.04 上使用 Rider 2017.3.1。

谷歌搜索无果后,我发现我应该修改.csproj文件。此外,正如@xtmq 指出的那样,the Microsoft .Net Core docs 指定哪些可用标签被识别为 NuGet 元数据属性。

因此,例如,我们可以在 PropertyGroup 部分中添加值,以便 Rider 生成 .nupkg 文件:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>
      ...
    </TargetFrameworks>
    <Authors>cavpollo</Authors>
    <Version>1.0.1</Version>
    <Description>My project Description</Description>
  </PropertyGroup>
  <ItemGroup>
      ...
  </ItemGroup>
</Project>