How to create a Visual Studio add-in for file generation?

I would like to create a Visual Studio add-in for creating files.

For example, I would like to create something similar to the Add Controller dialog box in ASP.NET MVC. This appears when you right-click on the Controller folder in an MVC project in Visual Studio.

However, instead of creating a controller file, I would like to create the classes "Handler", "Request" and "Reply" in the folder for my implementation of the service bus.

Creating these classes over and over again becomes a bit of a challenge, so I would like to automate it. Is the add-on the way here? Do I need to also use macros and / or T4 templates?

It would be nice to start the add-in by right-clicking on the folder and then selecting Add-> Handler or something like that. I'm sure there should be a way to do something like this, but I haven't found a good resource through Google yet.

For reference, I have already looked at these web pages for information:

+6
source share
1 answer

You can create patterns that could make you almost endless what you would like to do.

You can easily use your own templates with the built-in way, and you can extract them from

...\Documents\Visual Studio 20[XY]\Templates\ 

to transfer them by copying.

0
source

Source: https://habr.com/ru/post/916146/


All Articles