Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild "The windows SDK version 10.0.19041.0 was not found" even though it's installed

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

like image 928
mrr67man Avatar asked Jan 20 '26 17:01

mrr67man


1 Answers

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

like image 152
mrr67man Avatar answered Jan 23 '26 20:01

mrr67man



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!