Tim Van Wassenhove home

Consider this simple T4 template:

<# for (var i = 0; i < 10; ++i) { WriteLine("hello"); } #>

Trying to build the project results in a compilation error because β€˜var’ is an unknown type. A bit of research learned me that i should instruct the processor to use a specific c# version like this:

<#@ template language="C#v3.5" inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<# for (var i = 0; i < 10; ++i) { WriteLine("hello"); } #>

Problem solved πŸ™‚