未找到框架“.NETFramework,Version=v4.6.2”的参考程序集
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44548780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found
提问by Justin
When trying to compile a solution, I get the following build error:
尝试编译解决方案时,出现以下构建错误:
Error MSB3644 The reference assemblies for framework ".NETFramework,Version=v4.6.2" 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 framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. C:\RPR\Dev\Libraries\Common\Common.csproj C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1111
错误 MSB3644 未找到框架“.NETFramework,Version=v4.6.2”的参考程序集。要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到安装了 SDK 或 Targeting Pack 的框架版本。请注意,程序集将从全局程序集缓存 (GAC) 中解析,并将用于代替引用程序集。因此,您的程序集可能没有正确针对您想要的框架。C:\RPR\Dev\Libraries\Common\Common.csproj C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1111
I've tried installing the .NET Framework 4.6.2 SDK, as well as the 4.6 Targeting Pack, however both error that I already have it installed. I also tried installing Visual Studio 2017 but it still gives the same error.
我已经尝试安装 .NET Framework 4.6.2 SDK 以及 4.6 Targeting Pack,但是我已经安装了这两个错误。我也尝试安装 Visual Studio 2017,但它仍然给出相同的错误。
Any ideas?
有任何想法吗?
回答by Justin
It turns out that I had installed the .NET Framework v4.6.2, not the Developer Pack for 4.6.2. Doh!
事实证明,我安装的是 .NET Framework v4.6.2,而不是 4.6.2 的 Developer Pack。哦!
https://www.microsoft.com/en-us/download/details.aspx?id=53321
https://www.microsoft.com/en-us/download/details.aspx?id=53321
回答by Cata Hotea
Windows -> Search -> Visual Studio Installer -> Modify -> Individual Components and check the right version
Windows -> Search -> Visual Studio Installer -> Modify -> Individual Components 并检查正确的版本
回答by Rubanov
Installing the 4.6.2 Developer Pack did not work for me.
安装 4.6.2 Developer Pack 对我不起作用。
I had to install .NET Framework 4.6 Targeting Pack
回答by Jamie Butterworth
I was getting the exact same error when building except it was for ".NETFramework,Version=v4.7.1".
除了“.NETFramework,Version=v4.7.1”之外,我在构建时遇到了完全相同的错误。
I downloaded the Developer pack for 4.7.1 from here: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56119
我从这里下载了 4.7.1 的开发人员包:https: //www.microsoft.com/en-us/download/confirmation.aspx?id =56119
The pack installed these programs on the target machine (my build server).
该包在目标机器(我的构建服务器)上安装了这些程序。
- Microsoft .NET Framework 4.7.1 SDK
- Microsoft .NET Framework 4.7.1 Targeting Pack
- Microsoft .NET Framework 4.7.1 Targeting Pack (ENU)
- 微软 .NET 框架 4.7.1 SDK
- Microsoft .NET Framework 4.7.1 目标包
- Microsoft .NET Framework 4.7.1 目标包 (ENU)
When I tried building again, I didn't get the error anymore and the build succeeded.
当我再次尝试构建时,我不再出现错误并且构建成功。
回答by M.Hassan
Starting May, 2019you can build your project on net20 up to net48 (including ne461) any machine with at least MSBuild or the .NET Core SDK installed without the need of Developer Pack installed.
从 2019 年 5 月开始,您可以在 net20 到 net48(包括 ne461)至少安装了 MSBuild 或 .NET Core SDK 的任何机器上构建您的项目,而无需安装 Developer Pack。
If .NET Core SDK installed in you machine, Add the nuget package Microsoft.NETFramework.ReferenceAssembliesto your project
如果您的机器上安装了 .NET Core SDK,请将 nuget 包Microsoft.NETFramework.ReferenceAssemblies添加到您的项目中
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
The package include all ReferenceAssemblies starting net20 up to net48
该软件包包括从 net20 到 net48 的所有 ReferenceAssemblies
These packages enable building .NET Framework projects on any machine with at least MSBuild or the .NET Core SDK installed plus other scenarios.
这些包支持在至少安装了 MSBuild 或 .NET Core SDK 以及其他方案的任何计算机上构建 .NET Framework 项目。
For more details: https://github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies
更多详情:https: //github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies
回答by Raghav
For 4.7.2 issue I have to go here: https://dotnet.microsoft.com/download/dotnet-framework/net472
对于 4.7.2 问题,我必须去这里:https: //dotnet.microsoft.com/download/dotnet-framework/net472
Install the Download .NET Framework 4.7.2 Developer Pack as displayed in the image to fix the issue.
安装下载 .NET Framework 4.7.2 开发包(如图所示)以解决问题。


