如何在 csproj 中指定提交和分支以创建 nuget 包

Jul*_*ian 5 csproj nuget-package nuspec

因此,目前您可以配置分支并提交 .nuspec(请参阅参考资料):

<repository type="git" 
            url="https://github.com/NuGet/NuGet.Client.git" 
            branch="dev" 
            commit="e1c65e4524cd70ee6e22abe33e6cb6ec73938cb3" />
Run Code Online (Sandbox Code Playgroud)

但是我们如何从 SDK 样式的 .csproj 文件中配置它呢?目前我有类型和网址:

<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/NLog/NLog.git</RepositoryUrl>
Run Code Online (Sandbox Code Playgroud)

我找不到“分支”和“提交”的正确元素或属性。它也不在此页面上:MSDN - Additions to the csproj format for .NET Core

那么在从 sdk 样式的 csproj 创建 nuget 包时,如何配置分支和提交?

nel*_*ran 8

您要寻找的房产如下:

<RepositoryUrl>https://github.com/your/repository.git</RepositoryUrl>
<RepositoryBranch>release2.2</RepositoryBranch> <!-- optional branch reference -->
<RepositoryCommit>24ca19c71e8a84eeb8b9d3f95faa4b244db4341b</RepositoryCommit> <!-- optional commit reference -->
Run Code Online (Sandbox Code Playgroud)

请注意,这些只是添加到包元数据中,您仍然只能构建本地拥有的任何内容。