microsoft / VSSDK-Extensibility-Samples

Samples for building your own Visual Studio extensions
http://aka.ms/extendvs
MIT License
1.22k stars 452 forks source link

Question for single file generator extension #115

Open mmajcica opened 6 years ago

mmajcica commented 6 years ago

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")]

justcla commented 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.

mmajcica commented 6 years ago

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.