Mofcomp task

The Windows Driver Kit (WDK) provides the Mofcomp task so that you can run the Mofcomp.exe tool when you build your driver using MSBuld. For information about the tool, see mofcomp.

MSBuild uses the Mofcomp item to send the parameters for the Mofcomp task to Mofcomp.exe. The item metadata for Mofcomp is accessed using the Mofcomp item in project files.

The following example shows how to edit metadata in the .vcxproj file.

<ItemGroup>
    <Mofcomp Include="b.mof">
      <WMISyntaxCheck>true</WMISyntaxCheck>
    </Mofcomp>
</ItemGroup>

The following example shows the command-line invocation:

mofcomp.exe -WMI b.mof

This example invokes mofcomp.exe on the file b.mof with the -WMI switch.

Mofcomp Task Parameter Item Metadata Tool Switch Description
Sources @(Mofcomp) Required ITaskItem[] parameter. Specifies a list of source files.
Amendment %(Mofcomp.Amendment) -AMENDMENT:<Locale> Optional string parameter. Splits the MOF file into language-neutral and -specific versions.
Authority %(Mofcomp.Authority) -A:<Authority> Optional string parameter. Specifies Authority as the authority (domain name) to use when logging on to WMI.
AutoRecover %(Mofcomp.AutoRecover) -autorecover Optional Boolean parameter. Adds the named MOF file to the list of files compiled during repository recovery.
CreateBinaryMOFFile %(Mofcomp.CreateBinaryMOFFile) -B:<Filename> Optional string parameter. Requests that the compiler create a binary version of the MOF file with the name Filename without making any modifications to the WMI repository.
LanguageNeutralOutput %(Mofcomp.LanguageNeutralOutput) -MOF:<Path> Optional string parameter. Name of the language neutral output.
LanguageSpecificOutput %(Mofcomp.LanguageSpecificOutput) -MFL:<Path> Optional string parameter. Name of the language specific output.
MinimalRebuildFromTracking %(Mofcomp.MinimalRebuildFromTracking) Optional Boolean parameter. If true, a tracked incremental build is performed; otherwise, a rebuild is performed.
MOFClass %(Mofcomp.MOFClass)
  • -class:createonly
  • -class:forceupdate
  • -class:safeupdate
  • -class:updateonly
Optional string parameter. Allows or Disallows the creation or update of classes in MOF files. See the documentation on the -class family of switches for details.
MOFInstance %(Mofcomp.MOFInstance)
  • -instance:createonly
  • -instance:updateonly
Optional string parameter. Allows the creation or update of instances in MOF files. See the documentation on the -instance family of switches for details.
NamespacePath %(Mofcomp.NamespacePath) -N:<namespacepath> Optional string parameter. Requests that the compiler load the MOF file into the namespace specified as namespacepath.
Password %(Mofcomp.Password) -P:<Password> Optional string parameter. Specifies Password as the password for the computer user to enter when logging on.
ResourceLocale %(Mofcomp.ResourceLocale) -L:<ResourceLocale> Optional string parameter. Extracts the localized MOF descriptions from the binary MOF when used with -ER switch.
ResourceName %(Mofcomp.ResourceName) -ER:<ResourceName> Optional string parameter. Extracts binary MOF from a named resource.
SyntaxCheck %(Mofcomp.SyntaxCheck) -check Optional Boolean parameter. Requests that the compiler perform a syntax check only and print appropriate error messages. No other switch can be used with this switch.
ToolPath $(MofcompToolPath) Optional string parameter. Allows you to specify the full path to the folder where the tool is located.
TrackerLogDirectory %(Mofcomp.TrackerLogDirectory) Optional string parameter. Specifies the Log directory for tracker to write tlogs.
TrackFileAccess $(TrackFileAccess) Optional Boolean parameter. If true, tracks file access patterns for this task.
UserName %(Mofcomp.UserName) -U:<UserName> Optional string parameter. Specifies UserName as the name of the user who is logging on.
WMISyntaxCheck %(Mofcomp.WMISyntaxCheck) -WMI Optional Boolean parameter. Requests that the compiler perform a WMI syntax check. The -B: switch must be used with this switch.

mofcomp