Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regenerate T4 template after each build on build server without Vistual Studio

My solution file contains many projects which consist of many template files and I want regenerate each template after or before build on the project. I know how to do that locally, but I have problem how to do that on build server where Visutal Studio is not installed. Do you have any sollutions?

I know that are two sollutions form this source: Get Visual Studio to run a T4 Template on every build :
a) Visual Studio Visualization and Modeling SDK - i have to install visual studio (except Express Edition) and i can't do that
b) use TextTransform.exe tool, but then I have problems with missing dlls in GAC

Regards

like image 238
Adam Łepkowski Avatar asked Jul 13 '11 13:07

Adam Łepkowski


People also ask

What is Texttemplatingfilegenerator?

TT stands for - Visual Studio Text Template is a software development tool created by the Microsoft. Further explanation - TT file contains text block and control logic used for generating new files. To write the Text Template file we can use either - Visual C# or Visual Basic Code.

What is .TT file in Entity Framework?

T4 (Text template transformation toolkit) is template based code generation engine. So you can go and write C# code in T4 templates ( . tt is the extension) files and those c# codes execute to generate the file as per the written C# logic.


2 Answers

With Visual Studio 2010 SP1 and the Visual Studio Visualization and Modeling SDK for Visual Studio 2010, you're licensed to copy and redistribute the necessary files to do T4 transforms at build time on a build server (note, only a build server, not arbitrary redistribution). You can simply copy these files from a machine with Visual Studio and the SDK installed.

The two license files in question are: 1) buildserver.txt in the Visual Studio install directory 2) redist.txt in the VisualStudioIntegration\Tools\DSLTools directory of the SDK.

like image 142
GarethJ Avatar answered Nov 09 '22 15:11

GarethJ


I have found solution;)
For regenerate T4 templates file i use solution described by Cheburek from this page Get Visual Studio to run a T4 Template on every build.
But if I want to use Cheburek solution on build server without Visual Studio installed I need to add following dll files to GAC, and then everything is OK:)
1) Microsoft.VisualStudio.TextTemplating.10.0.dll
2) Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll

Regards

like image 38
Adam Łepkowski Avatar answered Nov 09 '22 17:11

Adam Łepkowski