Driver samples give build errors

james bloomscheff 1 Reputation point
2022-05-05T21:04:00.747+00:00

I have windows 10, vs2019, the latest WDK and SDK.

I can't get the windows driver samples to build. The samples were downloaded today and are dated late March

PLX9x5x gives the following

Severity Code Description Project File Line Suppression State

Error MSB4062 The "ValidateNTTargetVersion" task could not be loaded from the assembly C:\Program Files (x86)\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. plx C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets 302

and this

C:\Users\Test-Eng-220411\Desktop\Sample drivers\PLX9x5x\sys\Pci9x5x.vcxproj : warning : Wildcards in project items are not supported in VC projects and can cause unexpected behavior, instability and performance degradation in the Visual Studio IDE. Please refer to https://aka.ms/cpp/projectwildcards for supported options.

C:\Users\Test-Eng-220411\Desktop\Sample drivers\PLX9x5x\test\plx.vcxproj : warning : Wildcards in project items are not supported in VC projects and can cause unexpected behavior, instability and performance degradation in the Visual Studio IDE. Please refer to https://aka.ms/cpp/projectwildcards for supported options.

and this

1>C:\Users\Test-Eng-220411\Desktop\Sample drivers\PLX9x5x\sys\pci9x5x.inx(21-21): error 1284: Class "Sample" is reserved for use by Microsoft.

1>C:\Users\Test-Eng-220411\Desktop\Sample drivers\PLX9x5x\sys\pci9x5x.inx(33-33): error 1285: Cannot specify [ClassInstall32] section for Microsoft-defined class.

the pcidrv sample gives the following

2>C:\Users\Test-Eng-220411\Desktop\Sample drivers\pcidrv\kmdf\genpci.inx(19-19): warning 1324: [Version] section should specify PnpLockdown=1.

2>C:\Users\Test-Eng-220411\Desktop\Sample drivers\pcidrv\kmdf\genpci.inx(21-21): error 1284: Class "Sample" is reserved for use by Microsoft.

2>C:\Users\Test-Eng-220411\Desktop\Sample drivers\pcidrv\kmdf\genpci.inx(34-34): error 1285: Cannot specify [ClassInstall32] section for Microsoft-defined class.

and the same wildcard warnings

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,701 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,544 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,551 questions
{count} votes

4 answers

Sort by: Most helpful
  1. chen erich 5 Reputation points
    2023-02-21T10:47:23.6933333+00:00

    Copy
    C:\Program Files (x86)\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.16.0.dll
    to
    C:\Program Files (x86)\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll
    will fix this bug

    1 person found this answer helpful.
    0 comments No comments

  2. Limitless Technology 39,391 Reputation points
    2022-05-11T07:13:58.27+00:00

    Hi there,

    MSB4062 This error is emitted when a task assembly cannot be loaded prior to executing a task.

    Error MSB4018 may be caused when running a task in an environment that it was not prepared for, for instance when a task assembly targets 32-bit x86 but is running in a 64-bit MSBuild environment.

    To resolve this, ensure that the task expresses a dependency on the runtime environment it requires in the task's UsingTask element.

    UsingTask element (MSBuild) https://learn.microsoft.com/en-us/visualstudio/msbuild/usingtask-element-msbuild?view=vs-2022

    TraceLogging for kernel-mode drivers and components https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/tracelogging-for-kernel-mode-drivers-and-components

    -------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

  3. S.Sengupta 15,511 Reputation points MVP
    2022-10-02T00:48:48.327+00:00

    Uninstall, reinstall Visual Studio.

    0 comments No comments

  4. chen erich 5 Reputation points
    2023-02-21T08:57:16.2033333+00:00

    My scsi mini port driver project can build well in vs2019 but get this error in vs2022.