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

倾然丶 夕夏残阳落幕 提交于 2019-12-12 07:24:45

问题


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:

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.

Here's a screenshot with the full context:

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)

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

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.

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.

The machine is running Windows 7 (64 bit).

Any ideas towards troubleshooting this issue would be warmly received!


回答1:


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.

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

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




回答2:


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.




回答3:


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.

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.

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

I hope that helps someone.




回答4:


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




回答5:


Thank you Aris!

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

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 ProgramFilesDir and ProgramFilesDir (x86) under

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 ;)

I hope that helps anybody.




回答6:


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




回答7:


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.




回答8:


Similar problem reported on Social MSDN. The unhappy solution was:

I solved the problem myself by doing the following steps:

a) because my problem occurs the first time after a Windows Security-Update for VS 2008, I´ve done a System-Recovery to get the state before the mentioned Win-Update

b) then I´ve un- and re-installed VS 2010 (including .NET Framework 4.0)

I'm just posting this because I just ran into this same error.




回答9:


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.

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




回答10:


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.

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.




回答11:


I had the same problem and my solution was:

  • Download Multi-Targeting Pack for Microsoft .NET Framework 4.0.3 from https://www.microsoft.com/en-us/download/confirmation.aspx?id=29052
  • Install

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




回答12:


OK for me what worked historically was to manually remove newer versions of .net, then install visual studio.

In windows 10 by default has a version of .net installed that is built in (I think) so cannot be uninstalled (4.5? 4.7?), at least I think that's what's going on, I certainly cannot remove it via "uninstall" I click that and it just stays in the list (4.5 that is). So my old answer, above, no longer works.

Also another clue, when you install the 7.1 Windows SDK it says "RTM .NET version 4...these components will not be installed".

Fix was to uninstall the Windows SDK, then temporarily spoof that version 4.7 was not installed. Then install the SDK. Now VS 2010 express loads my C++ projects again (I presume what it did was install .net 4.0 successfully). Either the offline ISO or web version seem to work with this.



来源:https://stackoverflow.com/questions/4636618/visual-studio-2010-error-project-target-framework-not-installed-when-opening

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!