Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is TextTransform.exe Located on Hard drive?

Tags:

t4

Where is TextTransform.exe located?

I'm trying to implement the solution in this post: Get Visual Studio to run a T4 Template on every build

However I'm getting an error

"'TextTransform.exe' is not recognized as an internal or external command, operable program or batch file."

I have been looking through the program files, however not sure where TextTransform.exe is located.

like image 321
Paul Avatar asked Jul 26 '10 16:07

Paul


3 Answers

It should be below

\Program Files\Common Files\Microsoft Shared\TextTemplating\

see: http://msdn.microsoft.com/en-us/library/bb126245.aspx

like image 84
CaffGeek Avatar answered Nov 15 '22 07:11

CaffGeek


Anyone coming to this question that's using VS 2017 or later should be using vswhere to locate this file. @codingdave's comment is the closest but that still won't work on many computers.

I've added an example to the Microsoft Docs article feedback that shows how to do this with Powershell.

#the path to VSWhere.exe is always in programfiles(x86)

$progFilesx86Path = [System.Environment]::ExpandEnvironmentVariables("%programfiles(x86)%")
$vsWherePath = Join-Path $progFilesx86Path "\Microsoft Visual Studio\Installer\vswhere.exe"

# this tells vswhere to use paths of the latest version of visual studio installed 
# to locate this exe anywhere in those paths, and return a single textual 
# value (not a json object or xml payload)

$ttExe = & $vsWherePath -latest -find **\TextTransform.exe -format value
if (-Not(Test-Path $ttExe)){
    throw "Could not locate TextTransform.exe"
}

#then to invoke a transformation
& "$ttExe"  c:\Source\YourTransform.tt
like image 32
StingyJack Avatar answered Nov 15 '22 05:11

StingyJack


From @codingdave's comment
For VS2017, VS2019 location of TextTransform.exe will be

C:\Program Files (x86)\Microsoft Visual Studio\<<Version>>\<<Edition>>\Common7\IDE
Version -> (2017/2019)
Edition -> (Community/Professional/Enterprise)

And in pre build event we can use macro like
"$(DevEnvDir)\TextTransform.exe" "$(ProjectDir)AssemblyInfo.tt"

like image 2
Palanikumar Avatar answered Nov 15 '22 07:11

Palanikumar