简体   繁体   English

PackageReference 条目中的 Version 属性是否有任何有意义的区别?

[英]Is there any meaningful difference where the Version attribute is in a PackageReference entry?

I'm currently crawling through a lot of csproj files, and one thing kinda confuses me.我目前正在浏览很多 csproj 文件,有一件事让我感到困惑。 Sometimes PackageReference entries fit on one line, like this:有时 PackageReference 条目适合一行,如下所示:

<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?当我尝试通过 Microsoft.Build.Evaluation.Project (csproj 文件的对象表示)自动操作它们时,第一个版本导致无法读取文件,但根据项目的开发人员,它们都完美地构建。有没有将 1 行版本转换为带有版本子元素的版本的缺点?

Both are valid and the same to modern versions of MSBuild.两者都是有效的,并且与现代版本的 MSBuild 相同。

In MSBuild 15 / Visual Studio 2017, the possibility of specifying item metadata as attributes was added ( GitHub Issue ).在 MSBuild 15 / Visual Studio 2017 中,添加了将项目元数据指定为属性的可能性( GitHub 问题)。

If you fail to load the project then you are using libraries of older versions of MSBuild, eg the fixed 4.0 version that is part of .NET Framework.如果您无法加载项目,那么您使用的是旧版本 MSBuild 的库,例如作为 .NET Framework 一部分的固定 4.0 版本。 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 .您可以使用来自 NuGet 的较新库(以及 Microsoft.Build.Locator 以在评估项目时使用本地 .NET SDK 安装) - 请参阅现有应用程序的升级指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 元素中的属性“版本”<PackageReference> 不被承认 - The attribute "Version" in element <PackageReference> is unrecognized PackageReference Update 和 PackageReference Include 有什么区别? - What is the difference between PackageReference Update and PackageReference Include? 在Paragraph.Parent属性不是FlowDocument的地方有什么有意义的用途? - Is there any meaningful use where the Paragraph.Parent property is not a FlowDocument? 元素中的“包含”属性<packagereference>无法识别</packagereference> - The attribute "Include" in element <PackageReference> is unrecognized 加载csproj元素中的属性“ExcludeAssets”<packagereference> 无法识别</packagereference> - Load csproj The attribute “ExcludeAssets” in element <PackageReference> is unrecognized PackageReference 在控制台应用程序 C# 中的位置 - Where is PackageReference located in console application C# update-package 运行时约束 PackageReference 升级版本 - Constrain PackageReference upgrade version when update-package run 发布 Nuget 包时有关 PackageReference 版本的最佳实践? - Best practice regarding PackageReference version when publishing Nuget packages? 使用 PackageReference 时如何控制安装的依赖版本 - How control what depenent version is installed when using PackageReference 如何使用Google API版本2在Google日历中添加“哪里”条目 - How to add “Where” entry in Google Calendar using Google API Version 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM