I'm trying to get a Service like a DTE into a T4, for example,
<#@ import namespace="EnvDTE" #>
<#@ ActivityGraph processor="MyDSLDirectiveProcessor" requires="fileName='MyCatalogue.bcsfac'" provides="ActivityGraph=ActivityGraph" #>
<#
DTE vs = GetService(typeof(DTE)) as DTE;
#>
anybody know how can i do that
thanks!
jes

how can i get a Service into T4 textemplate.
am09qx30
Hi Jes,
Unfortunately, this is not possible. The template generation happens in a separate AppDomain from the Visual Studio AppDomain.
What are you trying to do with the DTE
Thanks,
George Mathew
DSL Tools Team
delaysteam
If you just need the DTE then you can get the active VS.NET instance:
EnvDTE80.DTE2 dte2;
dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");
WriteLine(dte2.Solution.FullName);
Also see: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=233989&SiteID=1
Hope it helps,
Gerben.