Forked from sayedihashimi/update-templates-for-aspnet5.ps1
Last active
August 29, 2015 14:24
-
-
Save kentcooper/cdd8db12d504d992683c to your computer and use it in GitHub Desktop.
Adds SortOrder to all the SideWaffle VS Item Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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