2

I'm trying to build my Visual Studio solution with MSBuild and I'm using this command to do so: msbuild mysolution.sln /p:Configuration=Debug /p:PlatformToolset=v142

But I get this following error:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.19041.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [D:...\mysolution.vcxproj]

Even though I have it installed in Visual Studio Installer and Visual Studio can use it without an issue:

enter image description here

1 Answer 1

4

Using the vcvarsall.bat before the msbuild fixed it.

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86 10.0.19041.0

I think you might also need to do that before the msbuild: set UseEnv=true

2
  • Great! Thanks for sharing your solution here, you could accept it as the answer, so it could help other community members who get the same issues and we could archive this thread, thanks.
    – Tianyu
    Aug 10, 2021 at 5:32
  • Thanks for the reminder, I will accept it once it lets me in 2 days.
    – mrr67man
    Aug 10, 2021 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.