Thomas,

Never had an issue with generated code from T4. All our generated code also
resides in source control so the moment you touched the .tt you also
modified the .generated and you push the together in the repo.
During a merge the same rules apply as any other merge, merge both .tt and
the generated.
Never had an issue yet (touch wood) and we have over 100 tts all over the
project but we are quite good not to change stuff in the same area in
different branches as each developer generally works in his own designated
areas.


On Wed, Oct 16, 2013 at 2:29 PM, Thomas Koster <[email protected]> wrote:

> Hi group,
>
> On Saturday, 12 October 2013, Greg Keogh wrote:
>
>> ...so I decided to use T4 templates to generate it all. I'm really happy
>> with the results and this post is basically just a reminder that in my
>> opinion, good old fashioned code generation still has a place in the modern
>> world.
>>
>
> I agree that code generation still has its place and would even go as far
> as saying it is *necessary* for most "real world" projects. I do have
> some criticisms of T4 though.
>
> My biggest issue with T4 is that prima facie it is not properly
> integrated, or integrable, into msbuild. A human often has to "Run custom
> tool" or "Transform all templates" manually in the IDE. If you are also
> mucking around with multiple revisions, e.g. using your VCS to bisect or
> even just to update, stale output can easily get out of hand that may
> result in subtly broken builds.
>
> From past Googlings I have only managed to turn up hack solutions, mostly
> three kinds:
>
>    1. Hand-write msbuild targets into your csproj that shell out to the
>    TextTransform.exe tool in the SDK. This is not the same thing as the VS
>    custom tool, resulting generated output that is different from the VS
>    TextTemplatingFileGenerator custom tool, if it even works at all. It is too
>    easy to write a T4 template that is incompatible with one or other host.
>    2. Install the Visual Studio Visualization and Modeling SDK to make
>    use of its msbuild targets (VS2010 and up only). This is yet another T4
>    host that is different from both the VS custom tool and TextTransform.exe.
>    And why burden your developers with such a huge compile-time dependency for
>    what should be a trivial msbuild configuration? What about build servers
>    that do not even have VS installed?
>    3. Commit generated output to your VCS. I put this hack in the same
>    basket as committing binaries.
>
> I am very interested in what T4 aficionados do to really make it work in
> large projects. What do you do when you build a fresh checkout of a project
> with many T4 templates? What about automated builds or continuous
> integration servers?
>
> p.s. I experience a homomorphic problem with most other code generation
> tasks in VS, especially DataSets generated from xsd files.
>
> --
> Thomas
>
>
>

Reply via email to