WDK tasks for MSBuild

The Windows Driver Kit (WDK) includes tools that are often used in the build process but are not normally distributed with Visual Studio. These tools are used to sign drivers or driver packages, implement software tracing, or to process and compile resource or message files (stampinf.exe, mc.exe, tracewpp.exe, binplace.exe, etc.). These command-line tools need to be exposed to MSBuild as tasks (contained in targets) so that they can be run during the build process. The WDK provides the necessary components so that you can run these tools as MSBuild tasks when you build your driver.

Note

The WDK tools listed here are typically used in the build process and have MSBuild tasks, for a complete list of the tools included in the WDK and tools that are useful for driver development, see the Index of Windows Driver Kit Tools.

The WDK command-line tools support a large number of options. Each option is exposed as a task parameter. When the tasks run, they can also receive inputs from the project file. MSBuild sets these properties immediately before executing the task. Each of the individual WDK task-wrapper classes create .NET properties that are available as input and output parameters for these tasks in the project file.

Tools that have WDK Tasks

The following table lists the tools and their corresponding task, target, and item names.

Tool Name Task Name Target Name Item Name
Tracewpp.exe Wpp RunWpp ClCompile
StampInf.exe StampInf StampInf Inf
Mofcomp.exe Mofcomp Mofcomp Mofcomp
Wmimofck.exe Wmimofck Wmimofck Wmimofck
mc.exe Mc MessageCompile MessageCompile
Ctrpp.exe Ctrpp Ctrpp Ctrpp

The following example shows how to invoke the tools.

<ItemGroup>
    <ClCompile Include="a.c" />
    <ClCompile Include="b.c">
        <WppEnabled>true</WppEnabled>
    </ClCompile>
</ItemGroup>

The example above invokes tracewpp.exe on the file b.c as if you issued the command tracewpp.exe b.c.

In this section

Topic Description
TraceWPP task The WDK provides the TraceWPP task so that you can run the tracewpp.exe tool when you build your driver using MSBuild. The tracewpp.exe tool is used to implement WPP Software Tracing
Stampinf task The WDK provides the StampInf task so that you can run the stampinf.exe tool when you build your driver using MSBuild. For information about the stampinf.exe tool, see Stampinf
Wmimofck task The WDK provides the Wmimofck task so you can run the wmimofck.exe tool when you build a driver using MSBuild.
Mofcomp task The WDK provides the Mofcomp task so that you can run the Mofcomp.exe tool when you build your driver using MSBuld.
Message compiler task The WDK provides the MessageCompiler task so that you can run the MC.exe tool when you build your driver using MSBuild. For information about using MC.exe, see Message Compiler (MC.exe)
Ctrpp task The WDK provides the Ctrpp task so that you can run the ctrpp.exe tool when you build your driver using MSBuild.

CTRPP

Using Wmimofck.exe

Message Compiler (MC.exe)

mofcomp

Stampinf

WPP Preprocessor