nuspec 和 csproj 包版本标签

编程入门 行业动态 更新时间:2024-10-25 14:34:46
本文介绍了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>github/theprojectname</RepositoryUrl> <PackageLicenseUrl>github/theprojectname/blob/master/LICENSE.txt</PackageLicenseUrl> <PackageProjectUrl>myproject/</PackageProjectUrl> <PackageIconUrl>github/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 包版本标签

本文发布于:2023-11-06 17:24:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564318.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   标签   nuspec   csproj

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!