« Return to Thread: Is it possible to get EnvDTE80.DTE2 within IronPython?

Is it possible to get EnvDTE80.DTE2 within IronPython?

by Piaoger () :: Rate this Message:

Reply to Author | View in Thread

I want to create a Ironpython script to automating Visual Studio and try to use methods presented by EnvDTE80 as well as VS Macro.

I know that It can be got in other environments:
1. VS Macro: using DTE directly.
2. C#:  
 _dte2 =  (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");

But how to do that in IronPython or how can we do the casting in IronPython as did in C#?


Thirsty for your reply and thanks in advance.



My code
#-----------------------------------------------------------------
import clr
import System

from System.Runtime.InteropServices import Marshal
DTE = Marshal.GetActiveObject('VisualStudio.DTE')
DTE.ExecuteCommand("IncrediBuild.BuildSolution")

import sys
sys.path.append(r'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies')
clr.AddReferenceToFile("EnvDTE90.dll")
clr.AddReferenceToFile("EnvDTE90a.dll")
clr.AddReferenceToFile("EnvDTE80.dll")
clr.AddReferenceToFile("EnvDTE.dll")

import EnvDTE
import EnvDTE80
import EnvDTE90

#Try to get DTE2 but falied now..
# Need help
 
#-----------------------------------------------------------------

 « Return to Thread: Is it possible to get EnvDTE80.DTE2 within IronPython?