1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00
simh.simh/Visual Studio Projects/ConvertToXPProject.ps1
Mark Pizzolato f98a4ca93a Visual Studio Projects: Add extensive support for Visual Studio 2022
- Pre-Pre-Build-Event.cmd now dynamically determines the available
  compiler version along with any alternate toolset which may be part
  of the build environment and makes the appropriate windows-build
  library support available for linking.
- build_vstudio.bat now supports VS2022 and will dynamically adjust
  the converted VS2008 project files to leverage any available XP build
  support which might be installed so that the generated executables
  will support all versions of Windows from XP onward.  The VS2008
  generated executables automatically support all versions of Windows
  from XP onward.
2022-11-24 11:11:52 -10:00

27 lines
1.2 KiB
PowerShell

# This script converts Visual Studio 2022 upgraded VS2008 projects to produce VS2022
# projects that will build executables that will run on all versions of windows since XP
#
ForEach ($arg in ($args))
{
if (-not (Test-Path -Path $arg -PathType Any)) {if (-not (Get-Item -Path $arg -ErrorAction Ignore)) {Write-Host "No such file: $arg"; continue; }}
ForEach ($file in (Get-Item -Path $arg))
{
$string = Get-Content -Path $file -Raw
if ($string.Contains("<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>")) {Write-Host "$file - already converted"; continue; }
Write-Host "Processing: $file"
$string = $string.Replace(
"<Keyword>Win32Proj</Keyword>
",
"<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
")
$string = $string.Replace("<PlatformToolset>v143</PlatformToolset>","<PlatformToolset>v141_xp</PlatformToolset>")
$string = $string.Replace(
' Label="LocalAppDataPlatform" />
',' Label="LocalAppDataPlatform" />
<Import Project="simh.props" />
')
$string | Out-File -Force -FilePath "$file" -Encoding utf8
}
}