Starting Visual Studio 2010: "type initializer for" <Module> "threw an exception."
I am working on a simple command line project. I changed the properties from .NET 3.5 to .NET 4.0 and restarted Visual Studio 2010. I get this error:
The type initializer for '<Module>' threw an exception.

and Visual Studio does not start.
I tried to start with devenv.exe /SafeMode and devenv.exe /reset , which doesn't matter. Google doesn't help me either.
Help!
EDIT: I still can't get Visual Studio to do anything. I tried installing SharpDevelop, but this also does not start, but with a more informative error:
Unhandled exception terminated SharpDevelop Exception thrown: System.TypeInitializationException: The type initializer for 'ICSharpCode.Core.Presentation.MenuService' threw an exception. ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization. ---> System.DllNotFoundException: C:\Windows\Microsoft.NET\Framework\v4.0.21006\WPF\wpfgfx_v0400.dll ---> System.ComponentModel.Win32Exception: The specified module could not be found
I do not have .NET 4 in the path in the above error, I have a different version, so it is installed on C:\Windows\Microsoft.NET\Framework\v4.0.30319
I tried uninstalling .NET 4 and reinstalling it, but it does not do VS or #develop work and does not change the installation path.
I started working with a somewhat scary hack.
Trying to launch SharpDevelop gave me the same error, but with more detailed information - she was looking for a DLL in C:\Windows\Microsoft.NET\Framework\v4.0.21006\ , but my .NET 4 was installed in C:\Windows\Microsoft.NET\Framework\v4.0.30319\ .
I could not find a way to install the old version or change this broken link, so I just copied it to the whole folder v4.0.30319 on v4.0.21006 , after which everything began to work.
I received this interesting message when I again opened the solution I was working on. Clicking OK opened my solution as usual. 
I suppose this is due to the way I caused the problem - I have to somehow set the target structure of the solution to one that I don’t have on my machine (although there was only one entry for .NET 4 in the drop-down list), which I suppose then set some flag somewhere on my machine for my "current" or "active" version of .NET ... I guess here, but hopefully this can help someone who stumbles over it problem.
If Visual Studio does not start, it is most likely a third-party component that loads during startup, which causes this problem. The best way to fix this is to remove, if possible, the extensions. If you don’t try
devenv / resetSettings
After that, the next step is to try to restore the installation.
This error occurs because the version of the studio MSSQL server management program is older than the Business Intelligence Data Tools that we installed to manage SSIS packages.
You can fix this by downloading the new MSSQL 2012 SP1 server management studio at: http://download.microsoft.com/download/0/1/E/01E0D693-2B4F-4442-9713-27A796B327BD/SQLManagementStudio_x64_ENU.exe After which you you can - Uninstall the MSSQL server server setup program - Or you just need to run the downloaded package (SQLManagementStudio_x64_ENU.exe), and then start the installation using the option "New stand-alone SQL Server installation or add functions to an existing installation". The installation will update all the necessary library. After restarting the computer, the error disappears.
If the cause of the problem is the VB program itself, and not the project code, delete all the frameworks on your computer using uninstall programs to completely remove all the registries and files associated with all of these frameworks and components listed below:
VC 90 Runtime (x86)
VC 10.0 Runtime (x86)
VC 10.0 Runtime (x64)
Microsoft NET Framework 4
Microsoft Visual Studio 2010 - 4 Bit Prerequisites (x64)
Microsoft Visual F # 2.0 Runtime
Microsoft Visual Studio Macro Tools
TFS Object Model (x64)
Multipage Package .NET Framework 4
Microsoft Visual Studio 2010 Ultimate
Microsoft Web Deployment Tool (x64)
Microsoft ASP, NET MVC 2 - Visual Studio 2010 Tools
Microsoft ASPNET MVC 2
Microsoft silverlight
Microsoft Silverlight 3 SDK
Microsoft Office Development Tools (x64)
Dotfuscator Software - Community Edition
Crystal Reports Templates for Visual Studio 2010
Microsoft SQL Server Compact 3.5 SP2 (x86) ENU
Microsoft SQL Server Compact 3.5 5P2 (x64) ENU
Visual Studio 2010 Tools for SQL Server Compact 3.5 5P2 ENU
Microsoft Sync Framework Runtime v1.0 (x64) ENU
Microsoft Sync Services for ADO.NET v2.0 (x64) ENU
Microsoft Sync Framework Services v1.0 (x64) ENU Microsoft Sync Framework Services SDK vl.0 (x64) ENU VC 10.0 Designtime (x64) Performance Tools Microsoft Visual Studio 2010 (x64)
Microsoft Visual Studio 2010 IntelliTrace (x64)
Microsoft SQL 1.4 Publishing Wizard
Microsoft SQL Server CLR Types
CLR Types for Microsoft SQL Server (x64)
Microsoft SQL Server 2008 R2 Management Objects
Microsoft SQL Server 2008 R2 Management Objects (x64)
Microsoft SQL Server 2008 R2 Framework for data tier applications
Microsoft SQL Server 2008 R2 Data Layer Application Project
SQL Server 2008 R2 Transact-SQL Language Service
Microsoft SharePoint Development Tools
Microsoft Visual Studio 2010 ADO, NET Framework Framework
Microsoft Help Viewer 1.0 x64
After uninstalling, restart your computer and install Visual Studio 2010 again after installation, it will say “Setup Success” if you completely remove the frameworks and reinstall them again using this installation with VB 2010 compatible framework / components.