"Write code that writes code" in Visual Studio 2010?
"Write code that writes code" is one of the tips given in the popular text, "The Pragmatic Programmer".

I would like to know how this can be accomplished in Visual Studio.  I work in a .net environment and I've benefited from some of the other advice in "The Pragmatic Programmer", but I have no idea how I would be able to write code that writes code, have it automatically run in my project, and not have Visual Studio's error checking go absolutely insane.

How can I write code that writes code in Visual Studio 2010?
"Write code that writes code" in Visual Studio 2010?
===

"Write code that writes code" is one of the tips given in the popular text, "The Pragmatic Programmer".

I would like to know how this can be accomplished in Visual Studio.  I work in a .net environment and I've benefited from some of the other advice in "The Pragmatic Programmer", but I have no idea how I would be able to write code that writes code, have it automatically run in my project, and not have Visual Studio's error checking go absolutely insane.

How can I write code that writes code in Visual Studio 2010?