运行环境:Visual Studio 2019
WDK版本:wdksetup10.0.19041.685
SDK版本:Windows 10.0.19041.685
1、A WDK corresponding to target version '10.0.19041.0' was not found. Please install this WDK version before building.
WDK和SDK安装完成后,在属性里配置好了Windows SDK版本和平台工具集,如下图所示,但是会报上面的报错提示信息,百思不得其解。
在网上查找了几个答案,都无法解决该问题,最后在官网里找到了答案:
WDK Known Issues - Windows drivers | Microsoft Learn
Error ‘A WDK corresponding to target ’10.0.19041.0’ was not found.’
When selecting [Windows SDK Version] to '10.0 (latest installed version)' with WDK 10.0.19041.0 causes the "A WDK corresponding to target version '10.0.19041.0' was not found" error even if the SDK version is installed.
Workaround: In the properties page for the driver project (Configuration Properties >General) set Windows SDK Version to $(LatestTargetPlatformVersion). If this option is not available to select then select the option inherit from parent or project default.
解决方法:在驱动程序项目的属性页面(配置属性>常规)中,将Windows SDK版本设置为$(LatestTargetPlatformVersion)。如果此选项不可选择,则选择“从父级继承”选项或项目默认选项。
结果:完美解决。希望对你有帮助。