Visual Studio 2010 错误:打开 .NET 4.0 项目时出现“未安装项目目标框架”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4636618/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:06:22  来源:igfitidea点击:

Visual Studio 2010 error: "Project Target Framework Not Installed" when opening a .NET 4.0 project

.netvisual-studiovisual-studio-2010frameworkstarget

提问by Mike Wilson

I am experiencing a rather disconcerting issue with one of my development machines that I hope someone can advise me on.

我的一台开发机器遇到了一个相当令人不安的问题,我希望有人能给我建议。

I have a large Visual Studio 2010 VB solution, targeting the .NET Framework 4.0 which opens and works just find on numerous Visual Studio 2010 installations - except one. The 'error' (more a message) when opening the solution says:

我有一个大型的 Visual Studio 2010 VB 解决方案,针对 .NET Framework 4.0,它可以在许多 Visual Studio 2010 安装中打开并运行 - 除了一个。打开解决方案时的“错误”(更多消息)说:

Project Target Framework Not Installed

The VB project is targeting '.NETFramework,Version=v4.0", which is not installed on this machine. You must download this framework in order to open and build this project. In order to proceed, you must select an option below.

未安装项目目标框架

VB 项目的目标是“.NETFramework,Version=v4.0”,它没有安装在这台机器上。你必须下载这个框架才能打开和构建这个项目。为了继续,你必须选择下面的一个选项。

Here's a screenshot with the full context:

这是包含完整上下文的屏幕截图:

http://img507.imageshack.us/i/errorlc.jpg/

http://img507.imageshack.us/i/errorlc.jpg/

I have tried:

我试过了:

  1. Repairing (didn't fix), uninstalling and reinstalling Visual Studio (didn't fix)
  2. Repairing (didn't fix), uninstalling and reinstalling .NET Framework 4.0 (didn't fix)
  1. 修复(未修复)、卸载并重新安装 Visual Studio(未修复)
  2. 修复(未修复)、卸载并重新安装 .NET Framework 4.0(未修复)

Retrying step number 1 again after step number 2 (didn't fix).

在第 2 步之后再次重试第 1 步(未修复)。

What worked temporarily was when I used a .NET Framework removal tool in order to remove all traces of the .NET Framework 4.0 from the machine (including the registry) and then installing the .NET Framework 4.0 again. However the error has returned.

暂时有效的是,当我使用 .NET Framework 删除工具从机器(包括注册表)中删除 .NET Framework 4.0 的所有痕迹,然后再次安装 .NET Framework 4.0 时。但是错误已经返回。

I'm not sure if this is a problem with some .NET Framework 4.0 file corruption, something within Visual Studio or simply that Visual Studio cannot find the .NET Framework 4.0. (I have found several possible 'explanations' but nothing that resolves this issue.

我不确定这是某些 .NET Framework 4.0 文件损坏的问题,还是 Visual Studio 中的问题,或者只是 Visual Studio 找不到 .NET Framework 4.0。(我找到了几个可能的“解释”,但没有任何东西可以解决这个问题。

The machine is running Windows 7 (64 bit).

机器运行的是 Windows 7(64 位)。

Any ideas towards troubleshooting this issue would be warmly received!

任何有关解决此问题的想法都将受到热烈欢迎!

回答by Kyle Julé

I solved this issue for myself by downloading the appropriate Developer targeting pack. I made the mistake of trying to download the Runtime one, which apparently does not include the Visual Basic plug-in that you need.

我通过下载适当的开发人员定位包为自己解决了这个问题。我在尝试下载 Runtime 时犯了一个错误,它显然不包含您需要的 Visual Basic 插件。

I am using .NET Framework 4.5.1, and this is the link to the page I downloaded from:

我使用的是 .NET Framework 4.5.1,这是我从以下位置下载的页面的链接:

http://msdn.microsoft.com/en-us/library/5a4x27ek%28v=vs.110%29.aspx

http://msdn.microsoft.com/en-us/library/5a4x27ek%28v=vs.110%29.aspx

回答by Antonio

update or reinstall the framework in question. run visual studio setup. click restore to defaults. will find all installed frameworks and not modify or remove plugins or liscenses. Even kept my settings.

更新或重新安装有问题的框架。运行视觉工作室设置。单击恢复为默认值。将找到所有已安装的框架,而不是修改或删除插件或许可证。甚至保留了我的设置。

回答by Aris

I had the same issue. My pc has the windows in a small SSD drive and user profiles and both Program Files folders on another disk. I solved it by noticing that even I had changed the registry entries about Program Files folders location, the FW setup had still put some files on the default locstion. I copyed them to the right location and at last I have FW 4.0 again on the target frameworks

我遇到过同样的问题。我的电脑在一个小型 SSD 驱动器和用户配置文件中有 Windows,另一个磁盘上有两个 Program Files 文件夹。我通过注意到即使我更改了有关 Program Files 文件夹位置的注册表项来解决它,FW 设置仍然将一些文件放在默认位置。我将它们复制到正确的位置,最后我在目标框架上再次安装了 FW 4.0

回答by user158017

I had the same problem and tried the work around listed here.

我遇到了同样的问题,并尝试了此处列出的解决方法。

I went to properties and chose the framework 3.5 and the errors went away. I do have the problem that although the 4.0 problem is installed on my computer, Visual Studio can't find it, but I am not using any 4.0 specific functionality, so this works for now. If I figure out why the 4.0 framework is not detectable, I'll update this post with the fix for it, too.

我去了属性并选择了框架 3.5,错误就消失了。我确实遇到了一个问题,虽然我的计算机上安装了 4.0 问题,但 Visual Studio 找不到它,但我没有使用任何 4.0 特定功能,所以现在可以使用。如果我弄清楚为什么无法检测到 4.0 框架,我也会用修复程序更新这篇文章。

Edit:

编辑:

I don't know WHY there was a problem, but after reviewing the help at this forum. I used this utility to fully uninstall VS2010 and .NET Framework 4.0.

我不知道为什么会出现问题,但在查看了此论坛的帮助后。我使用此实用程序完全卸载 VS2010 和.NET Framework 4.0

I then fully reinstalled, AND I installed the Visual Studio 2010 Service Pack 1, and everything works!

然后我完全重新安装,并安装了 Visual Studio 2010 Service Pack 1,一切正常!

I hope that helps someone.

我希望能帮助某人。

回答by artur

Thank you Aris!

谢谢阿里斯

I was wondering why my VS 2010 stopped recognizing the .Net4.0 suddenly, until I came across your post above.

我想知道为什么我的 VS 2010 突然停止识别 .Net4.0,直到我在上面看到你的帖子。

I was working on a vbs script which was suppose to refer to %PROGRAMFILES%system variable, and was annoyed that no matter which one used (64bit or the (x86)) I was getting to the Program Files (x86)folder. So I found that the registry entry ProgramFilesDirand ProgramFilesDir (x86)under

我正在处理一个假设引用%PROGRAMFILES%系统变量的 vbs 脚本,并且很恼火,无论使用哪个(64 位或(x86)),我都进入了该Program Files (x86)文件夹。于是我发现注册表项ProgramFilesDirProgramFilesDir (x86)

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion

have the same value ("Program Files (x86)"), so intuitively change the non x86 value properly. And that is what messed up my VS 2010 instance. Rolled that setting back and now VS is fine, left with the vbs issue though ;)

具有相同的值(“Program Files (x86)”),因此直观地正确更改非 x86 值。这就是搞砸了我的 VS 2010 实例的原因。回滚该设置,现在 VS 很好,但仍然存在 vbs 问题;)

I hope that helps anybody.

我希望这可以帮助任何人。

回答by GlacJAY

I solved this problem by repairing my VS2010 installation using the original installer.

我通过使用原始安装程序修复我的 VS2010 安装解决了这个问题。

回答by OzaNoe809

I had the same problem and my solution was:

我遇到了同样的问题,我的解决方案是:

The problem was solved immediately (error message went away).

问题立即得到解决(错误消息消失了)。

回答by Kit

Your VS solution may have a project (or more) in it that reference something in the full .NET 4.0 profile, which you are likely to have on your development machines... except perhaps the one where you are having the problem. The .NET 4.0 Client Profile is definitely different, and doesn't support everything you might be needing.

您的 VS 解决方案中可能有一个项目(或更多)引用完整的 .NET 4.0 配置文件中的某些内容,您可能在开发机器上拥有该配置文件......除了可能出现问题的机器。.NET 4.0 客户端配置文件绝对不同,并且不支持您可能需要的所有内容

Solutions that involve fully re-installing Visual Studio work because VS installs the full .NET profile, not the client profile.

涉及完全重新安装 Visual Studio 的解决方案有效,因为 VS 安装完整的 .NET 配置文件,而不是客户端配置文件。

回答by Mike Wilson

I managed to resolve the issue by replacing the development machine with a new one. Not quite a resolution to the problem but it saved a lot of time uninstalling/reinstalling/repairing over and over again.

我设法通过用新机器更换开发机器来解决这个问题。不是解决问题的方法,但它节省了大量时间,一遍又一遍地卸载/重新安装/修复。

回答by lbp

Elsewhere I've seen: In VS 2010, the <TargetFrameworkSubset>tag was changed to <TargetFrameworkProfile>, and we no longer support "Full"; that's why you're getting the error. Until we fix this, you can just remove the <TargetFrameworkSubset>tag from your project file, and the project should open properly.

我在其他地方看到:在 VS 2010 中,<TargetFrameworkSubset>标签已更改为<TargetFrameworkProfile>,并且我们不再支持“完整”;这就是你收到错误的原因。在我们解决此问题之前,您只需<TargetFrameworkSubset>从项目文件中删除标记,项目就会正常打开。

If you don't have TargetFrameworkProfile specified in your project files then in MPF (at least) it defaults to the latest. And may be confused about whether it's installed.

如果您没有在项目文件中指定 TargetFrameworkProfile,那么在 MPF 中(至少)它默认为最新的。并且可能对它是否安装感到困惑。