nuspec and csproj package version tags(nuspec 和 csproj 包版本标签)
问题描述
我有一个发布到 NuGet 的新 ASP/.NET Core 项目.当我发布一个新包时,建议使用什么方法来保持 x.csproj 和 x.nuspec 中的版本标签同步?
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 sync when I publish a new package?
推荐答案
使用新的 .csproj 格式,您可以 在 .csproj 文件中添加所有信息以生成 NuGet 包.不再有理由使用 .nuspec 文件.
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>
某些元素(例如 <PackageId>)默认使用项目文件其余部分的设置,因此您不需要添加它们,除非您需要它们不同比默认值.
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.
请注意,您必须使用 dotnet 包(而不是旧的 NuGet.exe CLI) 或 Visual Studio 2017 以利用此功能.
Note you must use dotnet pack (rather than the old NuGet.exe CLI) or Visual Studio 2017 in order to utilize this feature.
这篇关于nuspec 和 csproj 包版本标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:nuspec 和 csproj 包版本标签
基础教程推荐
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
