Search code examples
t4mvc

T4MVC: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE80.CodeClass2'.


When using T4MVC and attempting to 'Run Custom Tool' I get this:

Running transformation: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE80.CodeClass2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{295ADCD4-B052-49EE-934E-C6B36862A7C6}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

This affects the whole machine, not an individual project.

I've tried:

  • Re-Installing
  • Uninstalling
  • Restarting VS
  • Restarting Machine

Solution

  • Figured it out.

    Remove the project from the solution and re-add it.