Search code examples
sdkcommandversionlineupgrade

Is it possible to change a Visual Studio projects Windows SDK version from the command line?


Once my Visual Studio project is generated it needs to upgrade the platform tool set and Windows SDK versions to the latest versions. I'm trying to find a way to upgrade the projects Windows SDK version from the command line, rather than in the GUI.

I currently using the following command:

devenv Myproject.sln /upgrade

The problem is that this command only upgrades the platform tool set and not the Windows SDK version.

Is there a way to upgrade/change the Visual Studio projects Windows SDK version from the command line?


Solution

  • Someone on Microsoft Q&A answered this question with the following solution which works:

    In powershell:

    $content=Get-Content -Path 'C:\Myproject.vcxproj'
     $newContent=$content -replace '10.0.19041.0', '10.0.22000.0'
     $newContent|Set-Content -Path 'C:\Myproject.vcxproj'