msbuild中的MC.exe

msbuild中的MC.exe,msbuild,wdk,Msbuild,Wdk,如何以正确的方式使用mc.exe进行编译。目前,我有一个构建步骤,运行相关命令,但查看 似乎有更好的办法 我不是msbuild的专家,所以请原谅这个问题有多简单。谷歌没有透露任何帮助 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup>

如何以正确的方式使用mc.exe进行编译。目前,我有一个构建步骤,运行相关命令,但查看

似乎有更好的办法

我不是msbuild的专家,所以请原谅这个问题有多简单。谷歌没有透露任何帮助

<Project 
    DefaultTargets="Build" 
    ToolsVersion="14.0" 
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <ItemGroup>
    <Filter Include="Message Source Files">
      <Extensions>mc;</Extensions>
      <UniqueIdentifier>{B796B525-44D3-4260-8C76-705DBADA1043}</UniqueIdentifier>
    </Filter>
  </ItemGroup>

  <ItemGroup>
    <MessageCompile Include="a.mc">
        <GenerateBaselineResource>true</GenerateBaselineResource>
    </MessageCompile>
  </ItemGroup>  

  <Target Name="Build">
    <DontKnowWhatGoesHere Sources="@(MessageCompile)"/>  
  </Target>
</Project>

mc;
{B796B525-44D3-4260-8C76-705DBADA1043}
真的

MSBuild生成通常通过项目中必须包含的
目标文件进行扩展,并扩展现有的生成过程。page证实了这一点:

这些命令行工具需要作为任务(包含在目标中)公开给MSBuild,以便它们可以在生成过程中运行

WDK MSDN页面还有一个关于以下内容的帮助页面:

WindowsDriver.Common.targets、WindowsDriver.masm.targets和WindowsDriver.arm.targets文件提供构建驱动程序所需的目标

我的
C:\ProgramFiles(x86)\Windows Kits\10\build
目录中的快速grep显示
MessageCompile
目标(实际处理
MessageCompile
项的步骤)是在
build\WindowsDriver.Common.targets
文件中定义的

完成项目中的目标后,您可以执行以下操作之一:

<Import 
   Project="C:\Program Files (x86)\Windows Kits\10\build\build\WindowsDriver.Common.targets" />


<!-- Option A: -->
<Target Name="Build" DependsOnTargets="MessageCompile">
  <!-- no need to do anything, the dependency target should do the work -->
</Target>


<!-- Option B: -->
<Target Name="Build" DependsOnTargets="MessageCompile">
  <!-- Use the Mc task which is the actual wrapper around the .exe,
       see the .common.targets file for the list of all parameters -->
  <Mc
    Sources                         ="@(MessageCompile)"
    ToolExe                         ="$(MessageCompileToolExe)"
    ToolPath                        ="$(MessageCompileToolPath)"
    Generated 
  />
</Target>