Search code examples
windowsvisual-studiosdkcontainerswdk

VS 2019 Compilation error using Windows SDK and wdk on windows containers


I'm compiling a solution and have made the following change in the .vcxproj file <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> from <PlatformToolset>v142</PlatformToolset>
I have VS 2019 professional and the Windows 10 1903 wdk and windows 10 sdk 19041 installed and I keep getting the following error when I try to compile the solution file, Any pointers on what am I doing wrong here are greatly appreciated!

error MSB8020: The build tools for WindowsApplicationForDrivers10.0 (Platform Toolset = 'Windows ApplicationForDrivers10.0') cannot be found. To build using the WindowsApplicationForDrivers10.0 build tools, please install WindowsApplicationForDrivers10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

The command to compile my solution file is as follows on the windows containers "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" && msbuild myproject.sln /m /p:Platform=x64 /p:Configuration="Release"


Solution

  • I had to install the wdk.vsix (wdk extension for Visual studio) manually after installing the WDK into the VS installation location. Following are the powershell commands to do this:

    Copy-Item ""${Env:ProgramFiles(x86)}\Windows Kits\10\Vsix\WDK.vsix"" 'C:\wdkvsix.zip'

    Expand-Archive 'C:\wdkvsix.zip' -DestinationPath 'C:\WdkVsix'

    Copy-Item 'C:\WdkVsix$VCTargets\Platforms*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms' -Recurse -Force