Has anyone found a way to get access to DynamicTypeService from within a T4 template in VS2012? All the code posted online and in the forums always has the same solution of using GetService() to retrieve the object. In VS2012 that doesn't work. The problem is that DTS is an abstract class, not an interface. The object that you'll get back is a COM object. Hence when you try to cast it you'll get the popular "Unable to cast a System._ComObject..." error. The error is correct because DTS does not implement any interfaces and therefore QI won't work. Yet there has to be some way of getting to this type so we can do type resolution. I'm wondering if it broken when they resolved the issue of T4 locking assemblies. Thoughts?
I'm looking into doing it the hard way using the Project to get the assemblies and types but that is sort of what DTS does so it doesn't make sense.
Michael Taylor - 1/18/2013
http://msmvps.com/blogs/p3net