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

查看:265
本文介绍了找不到框架.NETCore版本= 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 Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.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]

我怀疑对.NetCore v5.0的需求是由我的UWP.csproj文件中的这一行引起的:

I suspect the need for .NetCore v5.0 arises from this line in my UWP.csproj file:

<包装参考Include ="Microsoft.NETCore.UniversalWindowsPlatform" Version ="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版本= v5.0的参考程序集

The reference assemblies for framework .NETCore, Version=v5.0 were not found

根据错误日志,您似乎在计算机2上缺少.NET Framework SDK(.NET Core,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 Assemblies\Microsoft\Framework\.NETCore\v5.0

要安装它,请确保您安装了以下各个组件:

To install it, make sure you are install following individual components:

如果仍然存在该错误,请尝试从计算机复制目录 C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework \ .NETCore \ v5.0 1到机器2.

If you still have that error, please try to copy the directory C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v5.0 from machine 1 to machine 2.

希望这会有所帮助.

这篇关于找不到框架.NETCore版本= v5.0的参考程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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