什么是microsoft.net.build.extensions,它如何工作?

发布于 2025-02-10 14:39:43 字数 1424 浏览 2 评论 0原文

这个问题与我的其他stackoverflow问题/a>。

有人可以告诉我什么Microsoft.net.build.extensions是什么,为什么MSBuild有时会从中获取参考而不是 /包装文件夹?

问题描述:

我有C#应用程序(targeting .NET Framework 4.6.2)。我使用的是一些Nuget参考(例如Microsoft.dotnet.platformabstractions.2.1.0),依赖于System.Runtime.interopservices.runtimeInimeInformation(v4.3.0)。 Nuget将此.dll下载到我的 /包装文件夹,并使用文件版本 4.6.24705.1 < /strong>。 During build process this .dll is overriden by higher version 4.6.26011.1 from location "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\Microsoft.NET.Build 。

​由于这次是从较低版本4.6.24705.1的包装中复制的,因此不会运行。它说“无法加载文件或汇编'system.runtime.interopservices.runtimeInformation ...”


编辑:29.6.2022

so“ msbuild \ Microsoft \ Microsoft \ Microsoft.net.build.build.extensions.extensions”文件夹显然是通过安装而创建的。 NET SDK Visual Studio构建工具2019 通过 Visual Studio Installer 安装.NET SDK后,构建过程开始介意此文件夹,并且我的某些系统软件包在构建过程中被“覆盖”。也许它与 .netstandard 有关?有人可以解释在这种情况下构建过程如何工作吗?

this question is related to my other stackoverflow issue.

Can anybody please tell me what Microsoft.NET.Build.Extensions is and why msbuild sometimes takes references from it instead of /packages folder?

Problem description:

I have C# application (targeting .NET Framework 4.6.2). I am using some nuget references (e.g. Microsoft.DotNet.PlatformAbstractions.2.1.0) which is dependent on System.Runtime.InteropServices.RuntimeInformation(v4.3.0). Nuget downloaded this .dll to my /packages folder with file version 4.6.24705.1. During build process this .dll is overriden by higher version 4.6.26011.1 from location "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net462\lib\System.Runtime.InteropServices.RuntimeInformation.dll"

Everything works fine except my build machine msbuild folder does not contain Microsoft.NET.Build.Extensions and although build process is finished successfuly the result build is not going to run due to this lib which is copied this time from packages with lower version 4.6.24705.1. It says "Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation ..."


EDIT: 29.6.2022

So "MSBuild\Microsoft\Microsoft.NET.Build.Extensions" folder is apparently created by installing .NET SDK to Visual Studio Build Tools 2019 via Visual Studio Installer.
enter image description here
After I installed .NET SDK the build process starts to mind this folder and some of my System packages are "overidden" during the build process. Maybe it has something to do with .netstandard? Can somebody explain how does the build process works in this situation?

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

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

发布评论

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

评论(1

蛮可爱 2025-02-17 14:39:43

您有两种构建项目的方法:

  • 旧的MSBUILD任务,该任务在Legacy .NET Framework
  • SDK风格的项目上使用.NET CLI和.NET CORE ENGINE(包括.NET Framework)。

您使用后一种方法是因为.NET标准使用SDK型,并且SDK强制使用.NET Core Engine,因此您需要使用额外的.NET Core Engine(.NET SDK)更新构建计算机,以便在其上运行构建。

要提到的一件事是,.NET Core Engine在许多情况下都优先考虑,因此请注意,来自.NET Core的编译器不像我在.Resx Files编译中那样向后兼容.NET Framework。

您不应该在更改引擎时遇到任何问题,但有时您会在旧版项目中遇到讨厌的错误。

You have two approaches to building your projects:

  • Old MSBuild task that runs on legacy .NET Framework
  • SDK-style projects with .NET CLI and .NET Core Engine under the hood(including .NET Framework).

You use the latter approach because .NET Standard uses SDK-style and SDK enforces you to use .NET Core Engine so you need to update your build machine with an extra .NET Core Engine(.NET SDK) to run builds on it.

One thing to mention, .NET Core Engine takes precedence in many situations so watch out for situations where the compiler from .NET Core isn't backward compatible with .NET Framework as I had with .resx files compilation.

You shouldn't have any problems with changing the engine but sometimes you can encounter nasty bugs in legacy projects.

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