Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kentcooper/cdd8db12d504d992683c to your computer and use it in GitHub Desktop.
Save kentcooper/cdd8db12d504d992683c to your computer and use it in GitHub Desktop.
Adds SortOrder to all the SideWaffle VS Item Templates
$files = Get-ChildItem D:\GitHub\side-waffle\TemplatePack\ItemTemplates *.vstemplate -Recurse | % { $_.FullName }
foreach($filePath in $files){
[xml]$templateXml = Get-Content $filePath
$updatedFile = $false
'Processing [{0}]' -f $filePath | Write-Host
if($templateXml.VSTemplate.TemplateData.SortOrder){
' Found SortOrder'|write-host
}
else{
' Adding SortOrder'|write-host
$sortOrder = $templateXml.CreateElement($null,'SortOrder','http://schemas.microsoft.com/developer/vstemplate/2005')
$sortOrder.InnerText = '1000'
$templateXml.VSTemplate.TemplateData.AppendChild($sortOrder) | Out-Null
$updatedFile = $true
}
if($updatedFile){
$templateXml.Save($filePath)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment