Last active
December 31, 2020 16:58
-
-
Save kensykora/7f8ca3ca8d44e097c9a4 to your computer and use it in GitHub Desktop.
Pre-Build event for T4 Transformation
This file contains hidden or 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 | |
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 | |
if exist "%COMMONPROGRAMFILES(X86)%" ( | |
SET T4PATH="%COMMONPROGRAMFILES(X86)%\Microsoft Shared\TextTemplating\12.0\TextTransform.exe" | |
) else ( | |
SET T4PATH="%COMMONPROGRAMFILES%\Microsoft Shared\TextTemplating\12.0\TextTransform.exe" | |
) | |
:: transform all the templates | |
for /f %%d in (t4list.txt) do ( | |
set file_name=%%d | |
echo: \--^> !file_name! | |
%T4PATH% %%d | |
) | |
echo transformation complete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment