Message compiler task
The Windows Driver Kit (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).
MSBuild uses the MessageCompile Item to send the parameters for the MessageCompiler task. The MessageCompile item accesses the item metadata for mc.exe in project files.
The following example shows how to edit the metadata in the .vcxproj file.
<ItemGroup>
<MessageCompile Include="a.mc">
<GenerateBaselineResource>true</GenerateBaselineResource>
<BaselineResourcePath>c:\test\</BaselineResourcePath>
</MessageCompile>
</ItemGroup>
The following example shows the command-line invocation:
mc.exe –s "c:\test\" a.mc
In the example above, MSBuild invokes mc.exe on the file a.mc, with the –s switch because the metadata GenerateBaselineResource is set to true. Also, MSBuild uses the BaselineResourcePath metadata to specify the argument for –s switch.
MessageCompiler Task Parameter | Item Metadata | Tool Switch |
---|---|---|
Sources
Optional string parameter. Specifies the name of the manifest file to compile. Specifies the name of a message file to compile. |
@(MessageCompile) | <filename.man> <filename.mc> |
ANSIInputFile
Specifies that the Input file is ANSI (default). |
%(MessageCompile.ANSIInputFile) | -a |
ANSIMessageInBinFile
Specifies that the messages in the .BIN file should be ANSI. |
%(MessageCompile.ANSIMessageInBinFile) | -A |
EnableDebugOutputPath
If this is set to true, it enables the –x switch. |
%(MessageCompile.EnableDebugOutputPath) | |
DebugOutputPath
Specifies the folder into which the compiler places the .dbg C include file. The .dbg file maps message IDs to their symbolic names. |
%(MessageCompile.DebugOutputPath) | -x<path> |
EnableCallOutMacro
Adds callout macro to invoke user code during logging. This switch is not valid for C# and is ignored. |
%(MessageCompile.EnableCallOutMacro) | -co |
EventmanPath
Specifies the path to eventman.xsd file. |
%(MessageCompile.EventmanPath) | -w<file> |
GenerateBaselineResource
If this is set to true, it enables -s switch. |
%(MessageCompile.GenerateBaselineResource) | |
BaselineResourcePath
Generates binary resource per provider. Generates summary global resource MCGenResource.BIN. |
%(MessageCompile.BaselineResourcePath) | -s<path> |
GenerateC#LoggingClass
Generates C# (managed) logging class based on FX3.5 Eventing class. |
%(MessageCompile.GenerateC#LoggingClass) | -cs<namespace> |
GenerateC#StaticLoggingClass
Generates static C# (managed) logging class based on FX3.5 Eventing class. |
%(MessageCompile.GenerateC#StaticLoggingClass) | -css<namespace> |
GeneratedFilesBaseName
Specifies the base name of the generated files. The default is the basename of input file. |
%(MessageCompile.GeneratedFilesBaseName) | -z<basename> |
GeneratedHeaderPath
If this is set to true, it enables -h switch. |
%(MessageCompile.GeneratedHeaderPath) | |
HeaderFilePath
Specifies the path of where to create the C include file. The default is .. |
%(MessageCompile.HeaderFilePath) | -h<path> |
GeneratedRcAndMessagesPath
If this is set to true, it enables the -r switch. |
%(MessageCompile.GeneratedRcAndMessagesPath) | |
RCFilePath
Specifies the path of the RC includes file and the binary message resource files that it includes. The default is .. |
%(MessageCompile.RCFilePath) | -r<path> |
GenerateKernelModeLoggingMacros
Generates Kernel Mode logging macros. |
%(MessageCompile.GenerateKernelModeLoggingMacros) | -km |
GenerateMOFFile
Generates down-level support for all functions and macros that are generated. The MOF file is generated from the manifest. The MOF file is placed in the location specified by the "-h" switch. |
%(MessageCompile.GenerateMOFFile) | -mof |
GenerateOLE2Header
Generates the OLE2 header file. Uses the HRESULT definition instead of the status code definition. |
%(MessageCompile.GenerateOLE2Header) | -o |
GenerateUserModeLoggingMacros
Generates User Mode logging macros. |
%(MessageCompile.GenerateUserModeLoggingMacros) | -um |
HeaderExtension
Specifies the extension for the header file (1-3 chars). |
%(MessageCompile.HeaderExtension) | -e<extension> |
MaximumMessageLength
Generates a warning if the size of any message exceeds <length> characters. |
%(MessageCompile.MaximumMessageLength) | -m<length> |
PrefixMacroName
Defines the macro name prefix that is applied to each generated logging macro. The default is "EventWrite". |
%(MessageCompile PrefixMacroName) | -p<prefix> |
RemoveCharsFromSymbolName
Defines the text at the start of each event symbol name to remove before forming the macro names. The default is NULL. |
%(RemoveCharsFromSymbolName) | -P<prefix> |
SetCustomerbit
Sets the Customer bit in the entire message Ids. |
%(MessageCompile.SetCustomerbit) | -c |
TerminateMessageWithNull
Terminates all strings with null characters in the message tables. |
%(MessageCompile.TerminateMessageWithNull) | -n |
UnicodeInputFile
Input file is Unicode. |
%(MessageCompile.UnicodeInputFile) | -u |
UnicodeMessageInBinFile
Messages in .BIN file should be Unicode (default). |
%(MessageCompile.UnicodeMessageInBinFile) | -U |
UseBaseNameOfInput
Specifies that the .BIN filename should have .mc filename included for uniqueness. |
%(MessageCompile. UseBaseNameOfInput) | -b |
UseDecimalValues
Specifies the FACILTY and SEVERITY values in header file in decimal. Sets message values in header to decimal initially. |
%(MessageCompile.UseDecimalValues) | -d |
ValidateAgainstBaselineResource
If this is set to true, then it generates the -t switch. |
%(MessageCompile.ValidateAgainstBaselineResource) | |
BaselinePath
Validates against the baseline resource. |
%(MessageCompile.BaselinePath) | -t<path> |
Verbose
Specifies verbose output. |
%(MessageCompile.Verbose) | -v |
WinmetaPath
Specifies the path to the winmeta.xml file. |
%(MessageCompile.WinmetaPath) | -W<file> |