How to create .cs files automatically in Visual Studio ?
I want to create a macro / extension / template to not repeating common codes.
I want to generate them like; I want to write "Customer" in a textbox;
And this "generator" will generate CustomerRepository.cs to "Datas project". CustomerService.cs to "Services project", CustomerDto.cs to "Dtos project". So as you see I don't want to create every file one-by-one. I need a tool to generate and place those cs files to correct projects... How can I do that ?
I searched a lot and found CodeSmith Tools's Code Generator. http://www.codesmithtools.com/product/generator
But I want to buy it; it's too complex for what I need. I'm not sure that I can create this with nuget package system. Any idea/way to generating code files ?
Use T4 templates.
Below is a link for a simple tutorial on how to use T4 templates in Visual Studio. It is the same for VS 2013. This is simple, but T4 templates are very powerful, and can do a ton of cool stuff.
https://www.youtube.com/watch?v=u_HYlgac5M8