exception has been thrown by a target of invocation in Visual Studio 2013 exception has been thrown by a target of invocation in Visual Studio 2013 windows windows

exception has been thrown by a target of invocation in Visual Studio 2013


Google search and get the answer.Answer

My environment was too long environment variable PATH, after shorten bellow 2048 characters the problem was solved.


  1. Open C:\Windows\System32\SystemPropertiesAdvanced.exe
  2. Open Advanced > Environment Variables.
  3. Under System variables, find the "Path" entry.
  4. Copy the values inside.
  5. Study the contents of path and lookup some path that is long and repeat many times. the purpose is replace it with another variable.enter image description here

6, Add a new system variable entry that represent the entry found in #5.
In this case "C:\Program Files\Microsoft SQL Server" repeated 10 times , so it is my target to be tackled


%sql% for
"C:\Program Files\Microsoft SQL Server"

  1. Update the path in the path entry found in #3. such as

before:
c:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;

after
%sql%\Client SDK\ODBC\110\Tools\Binn\;


right click on VS Icon goto->properties->Shortcut->Advance-> Check 'Run As Administrator'. Now you have done you can normally open VS.