I'm new to Visual Studio Extensibility Framework to use VSPackage Extension. I want to obtain a DTE Object inside the user-control which is called inside MyToolWindow class.
I tried all the below possibilities:
1.EnvDTE80.DTE2
dte2; dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"); string solutionPath=dte2.Solution.FullName;
The above trial gives only SolutionPath of the 1st instance of the visual studio which is opened. For EX: If Math1.sln and Math2.sln is opened,only Math1.sln path is assigned to solutionPath.
- From the MSDN link,"this.GetService" cannot be recognized in the button1.click (Am I missing any thing here)
Once, DTE object is obtained I shall be easily be able to obtain solution Name of the current instance.
I must be able to obtain appropriate EnvDTE80.DTE object inside the click of the button which is inside User-control. This User-Control is called inside MyToolWindow.cs
Any help on this would be greatly appreciated.