未找到框架 .NETCore、Version=v5.0 的参考程序集 [英] The reference assemblies for framework .NETCore, Version=v5.0 were not found

查看:49
本文介绍了未找到框架 .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

根据错误日志,您的机器上似乎缺少 .NET framework SDK (.NET core, v5.0) 2. 您可以从以下目录中查看:

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 的参考程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆