T4Toolbox icon indicating copy to clipboard operation
T4Toolbox copied to clipboard

VS2022 & VS2019 support

Open hippasus opened this issue 3 years ago • 5 comments

Hi Oleg,

I've managed to make this excellent tool targeting to both Visaul Studio 2019 and Visual Studio 2022.

It is still using deprecated APIs, however, it works.

Hippasus.

hippasus avatar Nov 14 '21 11:11 hippasus

For anyone who want to use this tool, I'm uploading the built VSIX file here. For Visual Studio 2019: T4Toolbox.16.0.0.0.vsix.zip For Visual Studio 2022: T4Toolbox.17.0.0.0.vsix.zip

hippasus avatar Nov 14 '21 11:11 hippasus

This works a treat, thanks @hippasus

islaytitans avatar Nov 23 '21 16:11 islaytitans

Thank you for great work!

It stopped working since VS 17.2.4 update.

Severity	Code	Description	Project	File	Line	Suppression State
Error		Running transformation: System.Runtime.Serialization.SerializationException: Type 'Microsoft.VisualStudio.CommonIDE.Solutions.Dte.DteProjects' in Assembly 'Microsoft.VisualStudio.CommonIDE, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

Server stack trace: 
   at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeMessageParts(ArrayList argsToSerialize)
   at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage..ctor(IMethodReturnMessage mrm)
   at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.SmuggleIfPossible(IMessage msg)
   at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
   at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at EnvDTE._Solution.get_Projects()
   at Microsoft.VisualStudio.TextTemplatingB5EC13400F541F31CD2FF70C4DE270BF66420DA4352A9431CD2EB6412E99ACEBEDB91B4DA7F9C256938CE1D4BEBE32F59E9FD89030A3D4D1ED0703898B13BE6D.GeneratedTextTransformation.IdeUtils.FindProject(DTE dte, String name) in C:\introniseng\qa\Automation.CodeGeneration\T4\IdeUtils.tt:line 16
   at Microsoft.VisualStudio.TextTemplatingB5EC13400F541F31CD2FF70C4DE270BF66420DA4352A9431CD2EB6412E99ACEBEDB91B4DA7F9C256938CE1D4BEBE32F59E9FD89030A3D4D1ED0703898B13BE6D.GeneratedTextTransformation.TransformText() in C:\introniseng\qa\Automation.Maestro\MaestroClassGenerator.tt:line 9	Miscellaneous Files	C:\introniseng\qa\Automation.CodeGeneration\T4\IdeUtils.tt	16	

bn-obelu avatar Aug 04 '22 09:08 bn-obelu

it works on my computer, I'm using VS 17.2.5.

could you please show me your .tt file, are you using something like IServiceProvider.GetService ?

hippasus avatar Aug 05 '22 15:08 hippasus

Yes, I was using GetService, now it works with GetCOMService. One thing that I think is not working, if I update a template, the generator dosen't update the file with the changes, any ideea why?

bn-obelu avatar Aug 08 '22 08:08 bn-obelu