Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using nuget WDK in DMF project causes "Telemetry" task build errors #261

Open
paulpv opened this issue Nov 9, 2024 · 0 comments
Open

Using nuget WDK in DMF project causes "Telemetry" task build errors #261

paulpv opened this issue Nov 9, 2024 · 0 comments

Comments

@paulpv
Copy link

paulpv commented Nov 9, 2024

I had an existing solution with a few projects that would not compile until I added a nuget dependency on WDK.

I wanted to add a DMF project, so I:

  1. Cloned DMF
  2. Built the DMF solution
  3. In Visual Studio 2022 [Community] created a new standard KMDF project and removed some its boilerplate code
  4. Manually integrated Dmf.props into my KMDF DMF project following the [IMHO important but very buried] instructions at:
    https://github.com/Microsoft/DMF/blob/master/Dmf/Documentation/Driver%20Module%20Framework.md#simplifying-compilation-and-linking-with-dmf
  5. Added some basic hello world DMF code from:
    https://github.com/Microsoft/DMF/blob/master/Dmf/Documentation/Driver%20Module%20Framework.md#using-dmf-in-a-driver-that-does-not-have-a-deviceadd-callback
#include "DmfModules.Library.h"
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD StorageFwUpdateDeviceAdd;
EVT_WDF_OBJECT_CONTEXT_CLEANUP StorageFwUpdateDriverContextCleanup;
EVT_DMF_DEVICE_MODULES_ADD DmfDeviceModulesAdd;

/*WPP_INIT_TRACING(); (This comment is necessary for WPP Scanner.)*/
#pragma code_seg("INIT")
DMF_DEFAULT_DRIVERENTRY(DriverEntry, 
                        StorageFwUpdateDriverContextCleanup,
                        StorageFwUpdateDeviceAdd)
#pragma code_seg()

#pragma code_seg("PAGED")
DMF_DEFAULT_DRIVERCLEANUP(StorageFwUpdateDriverContextCleanup)
DMF_DEFAULT_DEVICEADD(StorageFwUpdateDeviceAdd,
                      DmfDeviceModulesAdd)
#pragma code_seg()
  1. I got some build errors related to 'WPP_CLEANUP' undefined and 'WPP_INIT_TRACING' undefined that I fixed per my report at Documentation needs to include adding <ClCompile ...><Wpp* ...></ClCompile> to VS project? #260
    This resulted in me adding the following to my code:
#include "Trace.h"
#include "DmfInterface.tmh"

and the following to my project file:

  <ItemGroup Label="WrappedTaskItems">
    <ClCompile Include="DmfInterface.c">
      <WppEnabled>true</WppEnabled>
      <WppKernelMode>true</WppKernelMode>
      <WppTraceFunction>TraceEvents(LEVEL,FLAGS,MSG,...)</WppTraceFunction>
      <WppGenerateUsingTemplateFile>{km-WdfDefault.tpl}*.tmh</WppGenerateUsingTemplateFile>
    </ClCompile>
  </ItemGroup>
  1. Built the project and got this error:
Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	MSB4064	The "DriverBinary" parameter is not supported by the "Telemetry" task loaded from assembly: Microsoft.DriverKit.Build.Tasks, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 from the path: C:\Program Files (x86)\Windows Kits\10\build\10.0.26100.0\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll. Verify that the parameter exists on the task, the <UsingTask> points to the correct assembly, and it is a settable public instance property.	KMDF WDF DMF VHF KMClone	{redacted}\packages\Microsoft.Windows.WDK.x64.10.0.26100.2161\c\build\10.0.26100.0\WindowsDriver.common.targets	1742
Error	MSB4063	The "Telemetry" task could not be initialized with its input parameters. 	KMDF WDF DMF VHF KMClone	{redacted}\packages\Microsoft.Windows.WDK.x64.10.0.26100.2161\c\build\10.0.26100.0\WindowsDriver.common.targets	1721

It took me about a day to diff my project with the DmfSamples and I eventually I realized the [obvious in hindsight] only difference was that my project had added a nuget dependency on WDK.

I removed the nuget WDK dependency and was surprised that the project built successfully.
I added back the nuget WDK dependency and got the same error.

I have since learned that my projects do not actually need to define a nuget WDK dependency.
But the nuget WDK package exists for some reason, and if someone uses it then they will probably run into this Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant