After installing some recent updates to some visual studio extensions and features, I started getting the following error when I was trying to start up Visual Studio 2010 or Visual Studio 2012.
“exception was thrown by the target of an invocation”
After Googling around for a little bit, I found a Stack Overflow article which described the issue. Apparently there is a max length to the Path System variable (I believe is 2048 characters), which if exceeded, will prevent a few different apps from functioning correctly, including Visual Studio 2010 and 2012. However, if you attempt to go to System, then to Advanced System Settings you will get another error because the path is too long.
“windows cannot find ‘ %windir% system32 systempropertiesadvanced.exe’ “
So, to correct this the first time, follow these steps :
- Go to your system32 folder in your Windows Directory (Most likely will be C:\Windows\System32)
- Find and run the executable System was trying to find – systempropertiesadvanced.exe
- You should be on the Advanced tab. If you are not, go there. Click Environment Variables
- Under the System Variables group, find the Path variable. Click Edit
- Copy to notepad, or text editor application. Delete unnecessary entries
- Make Sure the following stays (It’s Windows 7 default) – %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
- Copy back to the Variable Value, hit ok through all the dialogs, and you will be good to go!
* Please note you won’t see icons back for folders, etc… until Explorer is restarted. You will be able to open up Visual Studio right away again however.