DOCGroup / MPC

MPC (The Makefile, Project, and Workspace Creator)
67 stars 61 forks source link

Compile Error #196

Open LukeMouse opened 11 months ago

LukeMouse commented 11 months ago

in the template file MPC/templates/vs2017platforms.mpt it set WindowsTargetPlatformVersion = 10.0.17763.0 but my PC doesn't have Platform SDK with version 10.0.17763.0, when I generate mpc for vs2017 project script, I got compile error, I checked my MPC and found the settings above. so I tried to comment out this line under vs2017platforms.mpt and then I regenerated vs2017 project script again, when I compiled it, it said no error. A PC can install verious version of Platform SDK, The vs2017 env can set it automatically. I think specific the version of platform sdk version in the vs2017platforms.mpt is not a correct fashion, So does in the vs2019platforms.mpt

jwillemsen commented 11 months ago

With 2019 we set 10.0 as default, as far as I remember this didn't work with vs2017 when we tried that years ago, could you test when you change the default in vs2017platforms.mpt to 10.0

LukeMouse commented 11 months ago

I tried to change the default in vs2017platforms.mpt to 10.0 but it didn't work like vs2019. Also I found different version vs2017 (with different service package )should use different stategy, Under a lower version I just remove WindowsTargetPlatformVersion setting everything work fine, but when I did the same thing under the latest vs2017 I have to use WindowsTargetPlatformVersion setting;

LukeMouse commented 11 months ago

After referency form https://stackoverflow.com/questions/54134339/how-do-i-specify-any-windows-sdk-version-greater-than-10-0-in-a-visual-studio and may times tests, I found a solution as follow: First, Keep %MPC_ROOT%\templates\vs2017platforms.mpt as it's origin fashion. Second, Modify %MPC_ROOT%\templates\vc10.mpd and change \<\%if(WindowsTargetPlatformVersion)\%> \<\%WindowsTargetPlatformVersion\%>\</WindowsTargetPlatformVersion> \<\%endif\%> to \<\%if(WindowsTargetPlatformVersion)\%> \<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]\::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))\</LatestTargetPlatformVersion> \<TargetPlatformVersion>$(LatestTargetPlatformVersion)\</TargetPlatformVersion> <\%endif\%> I found this change work under vs2015 vs2017 and vs2019,I think under vs2017 it's not important to setting "WindowsTargetPlatformVersion" but we should setting TargetPlatformVersion correctly.