Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change Windows SDK version in Visual Studio C++ project

I have a Visual Studio C++ console application that I created with Visual Studio 2015 and now I can't compile it (with Visual Studio 2017) because it is targeting the Windows 8.1 SDK, which is not installed. The problem is that I can't retarget the project to the Windows 10 SDK.

What happens is that when I open the project properties page and go to General - Target Platform I see the Windows 10 SDK in the dropdown, and I am able to select it... but as soon as I press Apply, it reverts back to 8.1 by itself. No error message is provided.

enter image description here

Visual Studio installer says that, indeed, the listed SDK version is installed:

enter image description here

So what's going on here? Is there a way to retarget my project without having to install the Windows 8.1 SDK?

Not sure if that matters but: this project is actually just a "wrapper" around an existing bare project consisting of just a bunch of .cpp and .h files, which was developed by another person. I'm really not familiar with C++ development.

like image 442
Konamiman Avatar asked Jun 02 '17 09:06

Konamiman


People also ask

How do I change the Windows SDK version in Visual Studio code?

Open the shortcut menu for the project node, and choose Retarget projects. (In earlier versions of Visual Studio, choose Retarget SDK Version.) The Review Solution Actions dialog appears. In the Target Platform Version dropdown list, choose the version of the Windows SDK you want to target.

Is Windows 10 SDK required for C++?

Well, technically, you don't need the SDK. The most important pieces it offers you - API declarations, import libraries, etc, can be coded/obtained manually on an as-needed basis. The SDK simply provides the hard work already done for you.

Does Visual Studio include Windows SDK?

The Visual Studio SDK (Software Development Kit) is an optional feature in Visual Studio setup. You can also install the VS SDK later on.


1 Answers

After hours of struggling with this problem, I coincidentally discovered that selecting Project Properties/General, changing "Platform Toolset" to v141_xp (instead of v141) forcibly drops the Windows SDK Version to 8.1 or 7.0. I'm not sure how Visual Studio chooses which SDK to use.

EDIT: You must edit .vcxproj and change both:

<TargetPlatformVersion>10.0.17134.0</TargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
like image 193
nyanpasu64 Avatar answered Sep 17 '22 15:09

nyanpasu64