How to automatically include generated source files into a C# project in Visual Studio?

Posted by Charles Prakash Dasari on Stack Overflow See other posts from Stack Overflow or by Charles Prakash Dasari
Published on 2010-05-06T20:11:25Z Indexed on 2010/05/07 3:18 UTC
Read the original article Hit count: 322

I have a situation where I need to generate a bunch of C# code files in a prebuild step of a project and include the generated files into the current project for compilation. Is there a way to do this cleanly without having to muck with the project file every time the prebuild step is run?

My solution should work for both IDE based build and a Team Build based on MSBuild. Since both are MSBuild based, I suspect there won't be much difference; but wanted to call it out.

Any help is greatly appreciated, thanks!

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about c#