Skip to content

Instantly share code, notes, and snippets.

@CaitieM20
Created July 3, 2013 04:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaitieM20/5915504 to your computer and use it in GitHub Desktop.
Save CaitieM20/5915504 to your computer and use it in GitHub Desktop.
Powershell script to be used with Nuget packages. On install it programatically discovers all T4 Text Template Files in the Nuget Package and modifies their addition to the Project to exclude the Generator and LastGenOutput tags.
param($installPath, $toolsPath, $package, $project)
#Get all of the T4 files in the package extension .tt
$files = $package.GetFiles() | Where-Object {$_.EffectivePath -match "tt$"}
foreach ($file in $files)
{
$fileName = $file.EffectivePath
$ProjectItem = $project.ProjectItems | Where-Object {$_.Name -eq $fileName}
#Set CustomTool to empty not TextTemplatingFileGenerator
$CustomTool = $ProjectItem.Properties | where-object {$_.Name -eq "CustomTool"}
$CustomTool.Value = ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment