Search code examples
c#visual-studioauto-generate

Add autogenerated C# file into solution


In C++ I can autogenerate some classes and then modify an empty cpp file to

 #include "myautoclass.cpp"

in the prebuild step and these classes will be compiled and linked. Is there a way to do this in C# in a prebuild step? I'm on VS2010. Thanks.


Solution

  • One way of generating classes (and any other files) is by using T4 templates.

    An excellent set of tutorials can be found here.