[英]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.