Project to VCProject problem RRS feed

  • Question

  • Hi,

    I Whant to get the VCProjectInterface from a Project, but when use the code bellow i get an invalid cast exception.


    if (proj.Kind == vcContextGuids.vcContextGuidVCProject)


        VCProject vcProj = (VCProject)proj.Object;


    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.VCProjectEngine.VCProject'.
    This operation failed because the QueryInterface call on the COM component for the interface with IID '{238B5174-2429-11D7-8BF6-00B0D03DAA06}'
    failed due to the following error: Interfaz no compatible (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
     System.Exception {System.InvalidCastException}

    Any ideas to solve this issue?

    Monday, April 27, 2009 8:28 PM


  • Ensure that you are using the correct versions of Microsoft.VisualStudio.VC*.dll in the references because each VS version uses different version numbers.

    Which VS version are you using and which reference versions are you using?
    MZ-Tools: Productivity add-ins for Visual Studio: My blog about VS extensibility:
    • Marked as answer by pepone.onrez Tuesday, April 28, 2009 12:12 PM
    Tuesday, April 28, 2009 9:03 AM

All replies