tags:

views:

387

answers:

3

I have a custom program which preprocesses a C# file and generates a new C# file as output. I would like to invoke this from msbuild on each of the C# files in the project, then compile the output files instead of the original C# files. How would I go about this?

+1  A: 

I'm not sure if there is an easy way to perform it with default msbuild tasks. But you can create your own task to do whatever you want:

How To: Implementing Custom Tasks - Part I

Also you can search for suitable tasks at "MSBuild community tasks" site.

aku
A: 

If your custom program is an executable the easiest way would be to call the executable with Exec:

<Exec Command="your executable" />

I would recommend writing a custom MSBuild task though. You can look at the SDC Tasks for samples on how to do it.

Jivko Petiov
A: 

You might want to look into using the "custom tool" code generation techniques in Visual Studio; there's an article about it on CodeProject

Silver Dragon