Problem Launching IDE from host application

 

Q:

I'm using the official VSTA 2008.02 version and having a problem with launching the IDE from within my host application.
I followed the sample project and used the IDTEProvider type under the VSTADTEProvider namespace to launch the IDE.

code:

Dim dteProvider As IDTEProvider = CType(New VSTADTEProviderClass(),IDTEProvider)
Me.dte = CType(dteProvider.GetDTE("TBD", 0), EnvDTE.DTE)


I realized that VSTADTEProvider is still version 8.0 and it won't let me
open any add-in project created using the 2.0 templates. Is a new
VSTADTEProvider available in version 2.0? Or should I try another
approach to launch the IDE?
I have both VS2005 and VS2008 loaded, also both versions of VSTA (2005 & 2.0) installed.

 

A:

>> I realized that VSTADTEProvider is still version 8.0

Did you use the VSTADTEProvider COM reference with the path "%CommonProgramFiles%\Microsoft Shared\VSTA\9.0 directory"?  If so, you are using the right one.

>> it won't let me open any add-in project created using the 2.0 templates
This could be a problem with the templates instead of the VSTADTEProvider.  If you have VSTA v1 templates registered with the same name as a VSTA v2 template, you will need to unregister the VSTA v1 template before you can programmatically load the VSTA v 2 template with a call like:

string macroTemplatePath = sol.GetProjectTemplate("ShapeAppCSharp-AppLevel.zip", "CSharp");


Alternatively, you could get the macroTemplatePath by setting it directly with a call like:

String macroTemplatePath = "C:\Documents and Settings\All Users\Application Data\Microsoft\VSTAHost\ShapeAppCSharp\9.0\ProjectTemplatesCache\CSharp\ShapeAppCSharp-Macro_v2.zip\ShapeAppCSharp-AppLevel.csproj"

To unregister the templates, delete the extracted templates from :
%Documents and Settings%\%user%\Application Data\Microsoft\VSTAHost

%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\<Lang>\<HostID>

 

 

 


Posted May 22 2009, 02:47 PM by BillL
Filed under: , ,
Copyright Summit Software Company, 2008. All rights reserved.