Cannot open a project in Visual Studio after modifying installed .NET version

0

I had .NET 4.5 installed on my machine but that was causing some issues with some scripts we use at work. Basically, 4.5 made some changes to MSBuild that our scripts were reliant on so I had to uninstall 4.5, uninstall 4.0 and re-install 4.0 to "revert" my MSBuild version.

In my control panel it has these two entries:

  • Microsoft .NET Framework 4 Extended
  • Microsoft .NET Framework 4 Client Profile

Since then, I just went to go open up a VB Project on my machine because we just hired a new guy who is going to inherit this project that I in turn inherited from a former employee. But when I open it, VS presents me with this error:

The project Project is targeting ".NETFramework,Version=v4.0,Profile=Client", 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.

  • Retarget the project to .NET Framework 4. After the project opens, you can retarget it to another Framework or Profile.

  • Take me to the Framework Download Web Site.

  • Leave the project as unloaded

Option one gives another error:

Attempted re-targeting of the project has been canceled. '.NETFramework4.0' does not contain Microsoft.VisualBasic.dll, which is required for Visual Basic projects.

Which doesn't make sense, because that DLL is present in \Windows\Microsoft.NET\Framework (however it is not in \Framework64).

Option two tells me I need to repair my Visual Studios install in order to install the .NET Multi-Targeting pack when I run the executable that downloads. I do not have access to repair the install via the Control Panel, however.

Option three is, obviously, not an option as I need to prepare some stuff for the new hire.

SO, anyone know how I might be able to resolve this issue?

EDIT Project.sln:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DFProtocol", "DFProtocol\DFProtocol.vbproj", "{B1A29C9C-DD02-460C-B0F0-D78391791037}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|x86 = Debug|x86
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {B1A29C9C-DD02-460C-B0F0-D78391791037}.Debug|x86.ActiveCfg = Debug|x86
        {B1A29C9C-DD02-460C-B0F0-D78391791037}.Debug|x86.Build.0 = Debug|x86
        {B1A29C9C-DD02-460C-B0F0-D78391791037}.Release|x86.ActiveCfg = Release|x86
        {B1A29C9C-DD02-460C-B0F0-D78391791037}.Release|x86.Build.0 = Release|x86
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

sab669

Posted 2014-09-22T18:23:10.857

Reputation: 779

You are aware that 4.5.0 is a in-place replacement for .NET 4.0 right? Verify the solution's xml is correct. – Ramhound – 2014-09-22T18:29:18.227

As stated, 4.5 slightly modified MSBuild and was causing a lot of problems with some various, critical scripts we use. 4.5 was erroneously installed on my machine. – sab669 – 2014-09-22T18:30:41.213

Yes; Once you opened up the solution with 4.5 installed the solution was modified. Verify the solution references to the .NET 4.0 versions of the dll you reference to. If this is a 64-bit operating system and the project target is 64-bit then that would explain the error. I suggest you use the .NET Framework Cleaner, wipe everything, then install the .NET Framework 4.0 cagain – Ramhound – 2014-09-22T18:36:34.777

Sorry, I'm not sure what I should be seeing in the solution file but I've edited the original post with its content. Not overly familiar with VB or this sort of thing in general. Just a basic code monkey :P – sab669 – 2014-09-22T18:56:23.840

If you create a new vb solution does that work? – Ramhound – 2014-09-22T18:59:11.800

I am able to create a VB project, yes. However, at the top of the "New Project" window where it has the dropdown menu for which .NET Framework, only 2.0, 3.0 and 3.5 are present – sab669 – 2014-09-22T19:04:41.110

Did you try my previous solution with regards to the .NET Framework Cleaner? By using that utility I have ALWAYS been able to solve problems like this. – Ramhound – 2014-09-22T19:15:44.613

No answers