views:

332

answers:

1

I have a VS project that contains: 1. A Pre-Build action of running TextTransform on a "template.tt" to generate "generated.cs" 2. "generated.cs" listed as one of the files to compile (i.e. in the list of project files

When I build the project, the pre-build action is done, "generated.cs" is re-created but VS compiles the previous version of it (that I guess it loaded to memory at start of the build process).

What can be done so that the build will use the newlly generated cs file (that is generated in the pre-build action?

(note that in my situation the text transformation input is dynamic hence cannot be done in design time)

Thanks.

+1  A: 

I don't think you need a custom pre-build action. Just add the ".tt" file to your project and set its "Custom Tool" property to "TextTemplatingFileGenerator". You might want to make sure that the *.generated.cs files are also added to the project, but I think that VS takes care of that.

Spongman