The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
问题描述
我有一个使用 Visual Studio 2017 创建的 UWP 项目.它在这台机器(机器 1)上构建良好.
I have a UWP project that was created using Visual Studio 2017. It builds fine on this machine (machine 1).
但是,当我将项目复制到仅安装了 Visual Studio 2017 构建工具的机器(机器 2)并尝试使用 MSBuild 构建它时,我收到以下错误:
However, when I copy the project over to a machine (machine 2) where I only have the Visual Studio 2017 Build Tools installed, and attempt to build it using MSBuild, I get the following error:
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsMSBuild15.0BinMicrosoft.Common.CurrentVersion.targets
(1126,5): error MSB3644: The reference assemblies for framework ".NETCore,Version=v5.0" were not found. To resolve this
, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framewo
rk for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assemb
ly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted
for the framework you intend. [<path_to_my_UWP_project>UWP.csproj]
我怀疑我的 UWP.csproj 文件中的这一行需要 .NetCore v5.0:
I suspect the need for .NetCore v5.0 arises from this line in my UWP.csproj file:
<包参考包括="Microsoft.NETCore.UniversalWindowsPlatform" 版本="6.0.1"/>
< PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.1" />
我在机器 2 上构建之前进行了 nuget 恢复,我可以看到 microsoft.netcore.universalwindowsplatform 在 < 下成功恢复C_Users_me >/.nuget/packages,microsoft.netcore 也是如此.
I do a nuget restore before I build on machine 2, and I can see that microsoft.netcore.universalwindowsplatform successfully gets restored under < C_Users_me >/.nuget/packages, and so does microsoft.netcore.
然而,在机器 1 上,只有 microsoft.netcore.universalwindowsplatform 得到恢复,但它仍然可以通过 Visual Studio 正常构建.
On machine 1 however, only microsoft.netcore.universalwindowsplatform gets restored but it still builds fine via Visual Studio.
问题:为什么会出现此错误?如何解决此问题?
Question: Why am I getting this error and how do I fix the problem?
推荐答案
没有找到框架 .NETCore 的参考程序集,Version=v5.0
The reference assemblies for framework .NETCore, Version=v5.0 were not found
根据错误日志,您的机器 2 上似乎缺少 .NET 框架 SDK(.NET 核心,v5.0).您可以从以下目录检查它:
According to the error log, it seems you are missing the .NET framework SDK (. NET core, v5.0) on your machine 2. You can check the it from following directory:
C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETCorev5.0
要安装它,请确保安装以下单个组件:
To install it, make sure you are install following individual components:
如果您仍然有该错误,请尝试从机器复制目录 C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETCorev5.01 到机器 2.
If you still have that error, please try to copy the directory C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETCorev5.0 from machine 1 to machine 2.
希望这会有所帮助.
这篇关于未找到框架 .NETCore,Version=v5.0 的参考程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未找到框架 .NETCore,Version=v5.0 的参考程序集
基础教程推荐
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
- 将数据集转换为列表 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 如果条件可以为空 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
