"Exception has been thrown by the target of an invocation." when building a Visual Studio 2010 VSPackage

housemex408 picture housemex408 · Apr 28, 2011 · Viewed 18.5k times · Source

I recently create a couple of VSPackages for some Visual Studio extensions (menu bar/command). I compiled them correctly yesterday, checked into TFS (i'm the only one touching this project, FYI). I had already installed these extensions and were working fine. Today it doesn't compile! I get the following error:

Exception has been thrown by the target of an invocation.

This doesn't tell me anything, so i fired up Visual Studio with the following command:

devenv.exe /Rebuild > out.log

In my out.log, I see the following:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets(420,5): error : Exception has been thrown by the target of an invocation.

I have been stuck on this for hours and can no longer build these VSPackages. Anyone? This is really frustrating. I have already tried cleaning project/rebuilding/build using Visual Studio itself (not command line)

Answer

centralscru picture centralscru · May 8, 2013

I've experienced this issue several times in both vs2010 and vs2012, and manually deleting the "bin" and "obj" folders from the project then doing a "rebuild" normally does the trick.