Created
April 16, 2015 22:48
-
-
Save macromaniac/78ee9f6b5b74dbb46a8b to your computer and use it in GitHub Desktop.
Change the extension to equal whatever extension you're using, this file applies the t4 transformation (you can use it in the pre build events or post build events). If it is exists in your bin folder the command to run is "applyt4transform.bat ..\..".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
:: set the working dir (default to current dir) | |
set wdir=%cd% | |
if not (%1)==() set wdir=%1 | |
:: set the file extension (default to vb) | |
set extension=d.ts | |
if not (%2)==() set extension=%2 | |
echo executing transform_all from %wdir% | |
:: create a list of all the T4 templates in the working dir | |
dir %wdir%\*.tt /b /s > t4list.txt | |
echo the following T4 templates will be transformed: | |
type t4list.txt | |
set tt10="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\10.0\TextTransform.exe" | |
set tt11="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\11.0\TextTransform.exe" | |
set tt12="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\12.0\TextTransform.exe" | |
set tt13="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\13.0\TextTransform.exe" | |
set tt14="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\14.0\TextTransform.exe" | |
set tt15="%COMMONPROGRAMFILES(x86)%\microsoft shared\TextTemplating\15.0\TextTransform.exe" | |
set ttToUse=notFound | |
if exist %tt10% set ttToUse=%tt10% | |
if exist %tt11% set ttToUse=%tt11% | |
if exist %tt12% set ttToUse=%tt12% | |
if exist %tt13% set ttToUse=%tt13% | |
if exist %tt14% set ttToUse=%tt14% | |
if exist %tt15% set ttToUse=%tt15% | |
echo %ttToUse% | |
set blank=. | |
:: transform all the templates | |
for /f "delims=" %%d in (t4list.txt) do ( | |
set file_name=%%d | |
set file_name=!file_name:~0,-3!.%extension% | |
echo: \--^> !file_name! | |
%ttToUse% -out "!file_name!" "%%d" | |
) | |
echo transformation complete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment