未找到框架 .NETCore,Version=v5.0 的参考程序集

The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
本文介绍了未找到框架 .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 的参考程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

MSBuild cannot find a reference(MSBuild 找不到参考)
quot;File has a different computed hash than specified in manifestquot; error when signing the EXE(“文件的计算哈希值与清单中指定的不同签署EXE时出错)
Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI?(良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 MSBuild 脚本?)
Run an MSBuild target only if project is actually built(仅在实际构建项目时运行 MSBuild 目标)
MS-Build BeforeBuild not firing(MS-Build BeforeBuild 未触发)
Using C# 7.1 with MSBuild(将 C# 7.1 与 MSBuild 结合使用)