title: building TextTransform files via powershell Azure devops
body: <p>I simply want to build my t4 files via my azure build pipeline. I tried the following things:</p>
  <p>Adding the following powershell script to my solution items :</p>
  <pre><code>$progFilesx86Path = [System.Environment]::ExpandEnvironmentVariables(&quot;%programfiles(x86)%&quot;)
  $vsWherePath = Join-Path $progFilesx86Path &quot;\Microsoft Visual Studio\Installer\vswhere.exe&quot;
  
  $textTransformLocation = &amp; $vsWherePath -latest -find **\TextTransform.exe -format value
  if (-Not(Test-Path $textTransformLocation)){
      throw &quot;Could not locate TextTransform.exe&quot;
  }
  
  Get-ChildItem -Path .\ -Filter *.tt -r | % { 
      &amp; &quot;$textTransformLocation&quot; $_.FullName  -out $_.FullName.Replace(&quot;.tt&quot;, &quot;.cs&quot;)
  }
  </code></pre>
  <p>This script works fine when I call it with the powershell ISE and actually generates the .cs files in my project, but when I add a powershell task in my pipeline to execute it, nothing happens. My task description looks like:</p>
  <pre><code>- task: PowerShell@2
    inputs:
      filePath: '$(System.DefaultWorkingDirectory)/test.ps1'
  </code></pre>
  <p>When I run the pipeline it actually tells me the script has been executed succesfully (It also actually lists all found tt files via the command line), but the .cs files from tt have not been created.</p>
  <p>So after that I tried to get my files to build via the visual studio build, adding the following to my project file:</p>
  <pre><code>  &lt;Import Project=&quot;$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v16.0\TextTemplating\Microsoft.TextTemplating.targets&quot; /&gt;
  &lt;PropertyGroup&gt;
     &lt;TransformOnBuild&gt;true&lt;/TransformOnBuild&gt;
     &lt;!-- Other properties can be inserted here --&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>
  <p>This works when I build locally, but again doesn't generate files when the project is built via the pipeline.</p>
  <p>Does anyone know what I am missing here or how I could get this task done?</p>