Last active
August 29, 2015 14:20
-
-
Save deurell/50d9185662110daab572 to your computer and use it in GitHub Desktop.
project file conversion utility
This file contains hidden or 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
# project file conversion utility | |
param ( | |
[string]$folderPath = $(throw "-folderPath is required.") | |
) | |
$allProjectFiles = get-childitem -path $folderPath -Filter *.vcxproj -Recurse | |
foreach ($projectFile in $allProjectFiles){ | |
$projectFileContent = get-content $projectFile.FullName | |
$projectFileContent | | |
foreach-object {$_ -creplace [regex]::Escape("Debug|ARM"), "Debug|Win32"} | | |
foreach-object {$_ -creplace [regex]::Escape("Release|ARM"), "Release|Win32"} | | |
foreach-object {$_ -creplace [regex]::Escape("MinSizeRel|ARM"), "MinSizeRel|Win32"} | | |
foreach-object {$_ -creplace [regex]::Escape("RelWithDebInfo|ARM"), "RelWithDebInfo|Win32"} | | |
foreach-object {$_ -creplace "<Platform>ARM</Platform>", "<Platform>Win32</Platform>"} | | |
foreach-object {$_ -creplace "<PlatformToolset>v120_wp81</PlatformToolset>", "<PlatformToolset>v140</PlatformToolset>"} | | |
foreach-object {$_ -creplace "/machine:ARM", "/machine:Win32"} | | |
foreach-object {$_ -creplace "<ApplicationType>Windows Phone</ApplicationType>", "<ApplicationType>Windows Store</ApplicationType>"} | | |
foreach-object {$_ -creplace "<ApplicationTypeRevision>8.1</ApplicationTypeRevision>", "<ApplicationTypeRevision>8.2</ApplicationTypeRevision>"} | | |
foreach-object {$_ -creplace "<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>", "<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>"} | out-file $projectFile.FullName -encoding UTF8 | |
write-host 'converted' $projectFile | |
} |
Added converters for /machine:Win32 and PlatformToolset
usage:
win10-convert.ps1 -folderPath c:\dev\ff-sample\mobile\projects\testrun4\
Varför inte bara:
foreach-object {$_ -creplace [regex]::Escape("ARM"), "Win32"}
istället för alla olika fall?
Jag fick en bugg när jag gjorde det förut. Tror dock att det berodde på att jag inte escapade regexp korrekt. Troligtvis bara att byta och få lite snyggare kod.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forcing UTF8. Default writes UTF16 and Visual Studio doesn't like that for project files.