locked
VS2017 issues with KMDF driver build for Windows 7 RRS feed

  • Question

  • Hi,

    I am trying to build my driver for Windows 7. I have changed settings in solution property page to WDK 8.1 and toolkit to v120. After changes I am no longer able to open solution properties and pops up warning information: "There are no property page for the selection." If I try to compile solution I get error message in console: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.12.props(51,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk."

    I tried to reinstall WDK 8.1, SDK's with no help. I have installed VS2013 - no help. I am running out of ideas what to do. Any thoughts how can I compile driver for Win7?

    Cheers.

    Edit: I have newest release of VS2017 and I am working on Windows 10.

    Edit2: I have tried to reinstall SDK 8.1 and after reinstallation I am no longer able to chose it from Platform Toolset field however it does appear in VS Installer as installed component.


    • Edited by nb3m Thursday, July 11, 2019 9:40 AM
    Friday, July 5, 2019 8:04 AM

All replies

  • Hi nb3m,

    Sorry for delay in reply.

    According to your description, I could not reproduce this issue in my side. Could you build your project successfully in Windows 10?

    As far as I know, the WDK is corresponding to windows system, such as the driver could run with WDK 8.1 on windows 8.1 or later. Please refer more : KMDF VERSION.

    Please try to download the WDK 7.1 to run your driver on Windows 7.

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, July 8, 2019 3:49 AM
  • Hello Dylan,

    I can compile driver for Windows 10 using WindowsKernelModeDriver10.0 platform toolset and SDK version 10.0.17763.0.

    I have installed WDK 7.1 however it's not visible in Property Pages.

    According to msdn documentation WDK 8.1 is compatible with Windows 7. Same like v7.1 I can't choose 8.1 from Property Pages. I have tried to reinstall all SDK and WDK components without success.

    Best regards,

    nb3m

    Monday, July 8, 2019 8:39 AM
  • Hi nb3m,

    Thank you for reply.

    Please click Project -> retarget solution, then select the WDK8.1, then right-click project, set the toolset to v120

    Or please right-click your project -> upload the project -> right-click the project -> edit xxxx.vcproj

    Base on the error, please confirm whether the Microsoft.cpp.props file is in C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120, if not, please re-install VS 2013 with C++ package.

    If there is any update information, please feel free to contact us.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, July 9, 2019 2:23 AM
  • Hi Dylan,

    Right after open project in VS2013 I receive following message:

    "../driver.vcxproj : error  : Could not recognize the MSBuild value 'Driver' for property 'ConfigurationType' when converting to a VCProjectEngine legacy enumeration."

    There is as well "load failed" information on solution explorer.

    Best regards,

    nb3m




    • Edited by nb3m Wednesday, July 10, 2019 7:52 AM
    Wednesday, July 10, 2019 7:11 AM
  • Hi nb3m,

    Thank you for reply.

    According to this error, it seems that the enumeration is incompatible with the current project configuration.

    Please check this similar MSDN thread: Could not recognize the MSBuild value 'Driver' for property 'ConfigurationType' when converting to a VCProjectEngine legacy enumeration.

    And did you build the project with toolset v120 and target platform8.1 in win10 ? After my experiment, it could work normally in my side. If possible, please provide a sample to help us analysis it better.

    Look forward to your reply.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, July 10, 2019 10:19 AM
  • Hi Dylan,

    That link does not solve my problem - already checked that. In VS 2017, when I chose v120 I have received info "The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.cpp.props" was not found". In VS2013 I am not even able to open property page. Currently I wont be able to reproduce any error because I have decided to reinstall whole VS environment. I will let you know if that helps.

    If you would like to try compile my driver I would prefer to send it directly.

    Edit: I have made clean VS2017 install along with features: Windows 10 SDK (10.0.17763.0 and 10.0.17134.0), Windows 8.1 SDK. Afterwards I have installed WDK (10.0.17763.1) and WDK 8.1. Compilation failed again: " C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 8.1 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". If I try to retarget solution I get following message box:

    Any thoughts?

    Do I need VS2013 to compile driver for Windows 8.1? Or VS2017 with proper SDK and WDK is enough?

    Best regards,

    nb3m





    • Edited by nb3m Thursday, July 11, 2019 9:57 AM
    Wednesday, July 10, 2019 12:10 PM
  • Bump. (not sure if notification works for post editing)

    Cheers,

    nb3m

    Thursday, July 11, 2019 9:39 AM
  • Hi nbm3,

    Sorry for delay in reply.

    Did you install the desktop development with C++ for VS 2017?

    For the error "MSB8036: The Windows SDK version 8.1 was not found", please download the Windows SDK 8.1 here

    Then please confirm the whether the windows SDK directory:

    C:\Program Files (x86)\Windows Kits\8.1

    is corresponding with path which "C:\..\Microsoft.Cpp.WindowsSDK.targets" states.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Monday, July 15, 2019 5:12 AM
  • Hello Dylan,

    That link forwards to other forum. There is no SDK package to download. Anyway, solution from this webiste "... by right-clicking the solution and selecting "Retarget solution"." does not work because I don't have dropdown menu.

    Installed components:

    File Microsoft.Cpp.WindowsSDK.targets is located at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets" and is exactly this same.

    SDK 8.1 is installed and up to date.

    Any thoughts?

    Best regards,

    nb3m


    • Edited by nb3m Monday, July 15, 2019 8:55 AM
    Monday, July 15, 2019 8:29 AM
  • Hi nb3m,

    Sorry for delay in reply.

    If possible, could you share a screen shot about vcxproj file? which is like this:

    Note: right-click project -> upload project -> edit the xxx.vcxproj

    Or the notepad file for it using onedrive.

    BTW, I have tried to create a new KMDF project, and it could build in VS2017 after changing to win8.1 and v120, and it also works in vs2013.

    Also, please have a try to create a new KMDF project, then do same operations for it. 

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, July 17, 2019 5:08 AM
  • Hi Dylan,

    Even if I make new KMDF project I have this same problem - target Windows 10 works, Windows 8.1 does not.

    I can't chose v120. Options I have:

    If I change platform toolset to WindowsKernelModeDriver8.1 I am stuck with screen:

    My vcxproj file:

    Best regards,

    nb3m


    • Edited by nb3m Wednesday, July 17, 2019 8:36 AM
    Wednesday, July 17, 2019 8:33 AM
  • Hi nb3m,

    Thank you for sharing.

    From your image, the minimum visual studio version should be "12.0".

    Please follow these steps to modify it:

    #1 please follow this thread to add the visual studio 2013 (V120) into VS2017

    #2 please modify minimum visual studio version to "12.0"

    #3 change the platform toolset V120 -> change the target project to 8.1 -> change the platform toolset to V120

    #4 save and re-open the project

    Look forward to your feedback.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, July 18, 2019 11:18 AM
  • Hi Dylan,

    When I try to compile driver I get missing dependencies error:

    Seems like SDK is visible to VS now. I think we are closer to solution :)

    Edit: I found ntdef.h however new missing dependency error appears:

    Best regards,

    nb3m



    • Edited by nb3m Thursday, July 18, 2019 3:00 PM
    Thursday, July 18, 2019 1:58 PM
  • Hi nb3m,

    Thank you for feedback.

    Form your picture, please confirm all xx.h files are in the specified path, which are not just in the project branch.

    Please refer more: Cannot open include file with Visual Studio

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, July 19, 2019 2:33 AM
  • Hi Dylan,

    I am missing winapifamily.h in WDK 8.1 folder. File exists in WDK 10 folder and I am able to compile it on Windows 10.

    Best regards,

    nb3m

    Friday, July 19, 2019 7:39 AM
  • Hi nb3m,

    The file locates in C:\Program Files (x86)\Windows Kits\8.1\Include\shared  in my side.

    Please confirm these features has been enabled when you install it.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Friday, July 19, 2019 8:13 AM
  • Hi Dylan,

    I have reinstalled SDK and whole WDK. I am missing that file in my Windows Kits 8.1 and 8.0 folders. Which WDK installer shall I use?

    Edit: Currently my VS stopped recognizing WDK 10. I am not able to compile driver for Windows 10. Shall I reinstall Windows in order to get VS work?

    Best regards,

    nb3m


    • Edited by nb3m Monday, July 22, 2019 6:18 AM
    Friday, July 19, 2019 10:06 AM
  • I have wiped out whole Windows system, installed first VS2017, SDKs and at the end I have installed WDK. Finally I found winapifamily.h. According to the information from other websites you have to install SDKs first, and at the end WDK. Even though I am still struggling to compile my driver. Currently I am missing ntddk.h. In WDK 8.1 folders I found ntddkbd.h. How can I get ntddk.h compatible with WDK 8.1?

    Edit: Instead of ntddk.h I have ntddkbd.h in "Windows Kits\8.1\Include\shared" folder.

    Best regards,

    nb3m


    • Edited by nb3m Wednesday, July 24, 2019 1:43 PM
    Wednesday, July 24, 2019 1:11 PM
  • Hi nb3m,

    Thank you for feedback.

    Please try to download ntddk.h from Github:

    https://github.com/tpn/winsdk-10/tree/master/Include/10.0.14393.0/km

    Then try to copy it to shared path, or include it through your project properties: properties -> C/C++ -> General -> Additional Include Directories

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, July 25, 2019 4:50 AM
  • Hi Dylan,

    If I try to compile empty project with this file I get following output:

    Best regards,

    nb3m

    Friday, July 26, 2019 9:19 AM
  • All this looks very messy.
    For I never used WDK 8.1 with VS 2015 or 2017
    https://www.osr.com/nt-insider/2015-issue2/windows-10-wdk-visual-studio-2015/
    just a few remarks:

    1. Have you ever tried to build your driver for Windows 7 with VS 2017
    Windows SDK Version 10.0.17763.0
    Platform Toolset  WindowsKernelModeDriver10.0
    setting Target OS Version to Windows 7?

    2. WDK 7.1 does not have in any way a Visual Studio integration. It ships with its own build system and is purely command-line.
    Would only use it, when in need to target Windows XP.
    3. Getting in trouble, when trying to use WDK 8.1 in Visual Studio 2017, I would ask at
    https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=wdk
    There may be people around, who are actually working with more than one WDK versions on their boxes.

    With kind regards


    Friday, July 26, 2019 12:54 PM
  • Hello,

    Thanks for your replay.

    I am currently trying to compile new kmdf project. (File->New->Project->Kernel Mode Driver (KMDF))

    When I try compile as you suggest I get following stampinf.exe error:

    Best regards,

    nb3m

    Monday, July 29, 2019 2:03 PM
  • Sorry cannot reproduce with 10.0.17763.0 for kmdf-template Target OS Windows 7 / Windows 10 or higher on VS 2017.
    which is besides 'LatestTargetPlatformVersion' I have installed.
    I am a little confused about your status at the moment. Which WDK versions do you have installed after you wiped your system?
    Are you able to build kmdf driver at the moment for 'Windows 10' and only target OS 'Windows 7' fails with otherwise identical settings?
    In any case  I would have another try with (default), if not already done:
    Windows SDK Version  $(LatestTargetPlatformVersion)
    Not sure if a repair of WDK in Apps & Features helps, but maybe worth a try:

    https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f31f68a3-6ade-47bd-a65c-5dd8d3999551/msb6004-error-with-stampinf?forum=wdk

    https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/54378d30-487b-4b5b-9ab5-712fceaa1aca/msb6004-error-with-stampinf?forum=wdk



    With kind regards

    Monday, July 29, 2019 4:22 PM
  • Alright, I have changed SDK to 10.0.17134.0 version, 'platform toolset' to WindowsKernelModeDriver10.0, 'driver settings'->general->'target platform' changed to Desktop and 'target os' to Windows 7. Voila! Empty KMDF project compiles! :)

    My driver does not compile but I think it's different problem and I will open new discussion. I will leave this topic open until I am sure that driver works on Windows 7.

    Best regards,

    nb3m

    Tuesday, July 30, 2019 8:19 AM