packageReference条目中的版本属性是否有任何有意义的区别?

发布于 2025-02-01 18:19:03 字数 477 浏览 7 评论 0原文

我目前正在浏览许多CSPROJ文件,而一件事有点让我感到困惑。 有时,PackageReference条目适合一行,例如:

<PackageReference Include="DocuWare.ServerConfig" Version="10.2.0" />

虽然有些看起来像这样:

<PackageReference Include="DocuWare.MessageBus.Core">
    <Version>12.3.3</Version>
</PackageReference>

是否有有意义的区别?当我尝试通过microsoft.build.evaluation.project自动对其进行操作(csproj文件的对象表示形式,第一个版本都会导致未读取该文件,但是根据项目的开发,它们都无瑕。在将1行版本转换为带有子元素的版本的缺点?

I'm currently crawling through a lot of csproj files, and one thing kinda confuses me.
Sometimes PackageReference entries fit on one line, like this:

<PackageReference Include="DocuWare.ServerConfig" Version="10.2.0" />

While some others look like this:

<PackageReference Include="DocuWare.MessageBus.Core">
    <Version>12.3.3</Version>
</PackageReference>

Is there any meaningful difference? When I try to automatically maniplate them via Microsoft.Build.Evaluation.Project (an Object representation of a csproj file, the first version results in a failure to read the file, but according to the project's devs they all build flawlessly. Is there any downside in converting the 1 line version to the one with a child element for Version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追我者格杀勿论 2025-02-08 18:19:03

两者都有效,并且对MSBUILD的现代版本都是相同的。

在MSBUILD 15/Visual Studio 2017中,添加了属性的可能性( github noreferrer“> github earkess < /a>)。

如果您未能加载项目,则使用MSBuild的较旧版本的库,例如,固定的4.0版本是.NET Framework的一部分。您可以使用Nuget中的较新库(除了Microsoft.build.locator,locator在评估项目时使用local .NET SDK安装) - 请参阅“ nofollow noreferrer”>“ nofollow noreferrer”>升级指南

Both are valid and the same to modern versions of MSBuild.

In MSBuild 15 / Visual Studio 2017, the possibility of specifying item metadata as attributes was added (GitHub Issue).

If you fail to load the project then you are using libraries of older versions of MSBuild, e.g. the fixed 4.0 version that is part of .NET Framework. You can use the newer libraries from NuGet (in addition with Microsoft.Build.Locator to make use of local .NET SDK installations when evaluating projects) - see the upgrade guide for existing applications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文