0

ソースファイルから.hファイルを生成するカスタムビルドツールをVS2010に統合しようとしています。ステップ用に.xml、.targets、.propsを作成しました。XMLは、ほとんどの場合MASMファイルからコピーして貼り付けられ、次で終わります。

<ItemType Name="FOO" DisplayName="Foo compiler" />
<FileExtension Name="*.foo" ContentType="FOO" />
<ContentType Name="FOO" DisplayName="Foo compiler" ItemType="FOO" />

これにより、すべての.fooファイルが.propsで定義されているFooコンパイラにマップされます。

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
    <AvailableItemName Include="FOO">
      <Targets>FooCompile</Targets>
    </AvailableItemName>
  </ItemGroup>
  <UsingTask TaskName="FOO" TaskFactory="XamlTaskFactory" AssemblyName="Microsoft.Build.Tasks.v4.0">
    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
  </UsingTask>
  <Target Name="FooCompile" BeforeTargets="$(FOOBeforeTargets)" AfterTargets="$(FOOAfterTargets)" Condition="'@(FOO)' != ''" Outputs="%(FOO.Outputs)" Inputs="%(FOO.Identity);%(FOO.AdditionalDependencies);$(MSBuildProjectFile)" DependsOnTargets="_SelectedFiles">
    <Message Importance="High" Text="@(FOO)" />
    <FOO Condition="'@(FOO)' != '' and '%(FOO.ExcludedFromBuild)' != 'true'"
         CommandLineTemplate="%(FOO.CommandLineTemplate)"
         OutputFileName="%(FOO.OutputFileName)"
         Inputs="%(FOO.Identity)" />
  </Target>
</Project>

プロジェクトをコンパイルすると、fooファイルが正常に識別されてコンパイルされます。

1>FooCompile:
1>  apa.foo
1>FooCompile:
1>  banan.foo
1>ClCompile:
1>  test.cpp
1>  main.cpp

私の質問は、ClCompileが出力しないのに、なぜ「FooCompile:」をファイルごとに1回出力するのかということです。これを変更する方法はありますか?

cppファイルを変更してビルドすると、ファイルごとにこの出力も1回取得されますが、これは避けたいものです。

1>FooCompile:
1>Skipping target "FooCompile" because all output files are up-to-date with respect to the input files.
1>FooCompile:
1>Skipping target "FooCompile" because all output files are up-to-date with respect to the input files.
4

1 に答える 1

2

FooCompileターゲットは、「ターゲットバッチ処理」を使用しています。これにより、出力属性%(Foo)に指定された配列内のアイテムごとにターゲットが1回繰り返されます。一方、ClCompileターゲットは、アイテム配列@(ClCompile)全体を使用して動作します。

ロガーの詳細度を変更してメッセージを回避し、/ v:minimalを指定できますが、もちろん、他の情報も除外している可能性があります。

于 2011-08-28T05:33:39.697 に答える