Open mmajcica opened 6 years ago
The samples were written some time ago. Perhaps there are better ways to do things. If you submit a PR, we would be happy to take a look. Thanks for your interest in improving the samples.
I gave it a try and it also works with the BaseCodeGeneratorWithSite from Microsoft.VisualStudio.TextTemplating.VSHost.15.0 assembly. It makes the code way simpler. I'll try to propose the change because the example you are showing is 'way more complex' then it should be.
For the single file generator extension, why do you not start with the implementation of BaseCodeGeneratorWithSite in Microsoft.VisualStudio.TextTemplating.VSHost.15.0 assembly?
Also your sample doesn't register the file extension for our custom tool, an extra attribute is necessary for that to occur: [CodeGeneratorRegistration(typeof(XmlClassGenerator), "XmlClassGenerator", vsContextGuids.vsContextGuidVCSProject, GeneratesDesignTimeSource = true, GeneratorRegKeyName = ".xml")]