3 回答

TA貢獻1818條經驗 獲得超8個贊
將TextTransform.exe添加到 %PATH%
創建了一個名為Transform_all.bat的批處理文件(見下文) 創建預構建事件“ transform_all ..\..
"
變換所有蝙蝠
@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=vb 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 :: transform all the templates for /f %%d in (t4list.txt) do ( set file_name=%%d set file_name=!file_name:~0,-3!.%extension% echo: \--^> !file_name! TextTransform.exe -out !file_name! %%d ) echo transformation complete

TA貢獻1780條經驗 獲得超5個贊
安裝 安裝 在文本編輯器項目文件中打開并添加到文件末尾,但在此之前 </Project>
<!-- This line could already present in file. If it is so just skip it -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- process *.tt templates on each build -->
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets" />

TA貢獻1803條經驗 獲得超6個贊
添加回答
舉報