Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 用于生成.h文件的VS2010自定义生成工具_C++_Visual Studio 2010_Msbuild_Custom Build Step - Fatal编程技术网

C++ 用于生成.h文件的VS2010自定义生成工具

C++ 用于生成.h文件的VS2010自定义生成工具,c++,visual-studio-2010,msbuild,custom-build-step,C++,Visual Studio 2010,Msbuild,Custom Build Step,我正在尝试在VS2010中集成一个自定义构建工具,该工具从源文件生成一个.h文件。我已经为该步骤创建了.xml、.targets和.props。XML主要是从MASM文件复制粘贴的,并以以下内容结束: <ItemType Name="FOO" DisplayName="Foo compiler" /> <FileExtension Name="*.foo" ContentType="FOO" /> <ContentType Name="FOO" DisplayNam

我正在尝试在VS2010中集成一个自定义构建工具,该工具从源文件生成一个.h文件。我已经为该步骤创建了.xml、.targets和.props。XML主要是从MASM文件复制粘贴的,并以以下内容结束:

<ItemType Name="FOO" DisplayName="Foo compiler" />
<FileExtension Name="*.foo" ContentType="FOO" />
<ContentType Name="FOO" DisplayName="Foo compiler" ItemType="FOO" />
我的问题是,为什么它为每个文件打印一次“foocomile:”而ClCompile不打印?有没有办法改变这一点

如果我更改cpp文件并生成,我还将为每个文件获得一次此输出,我希望避免:

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.

FooCompile目标正在使用“目标批处理”,这会导致目标对为Outputs属性(%(Foo)指定的数组中的每个项迭代一次。另一方面,ClCompile目标使用整个项数组@(ClCompile)进行操作


您可以更改记录器的详细程度以避免消息,指定/v:minimal,但当然您也可能会过滤掉其他信息。

设置Outputs=“@(FOO->”%(OutputFileName)”)和Inputs=“@(FOO)…”使其工作得更好,但无法正常清理。我是否错过了一些步骤?你在做什么来支持清洁?它不是自动的,你需要自己连接它。看看@(文件写入),这可能就足够了(所有这些都在我的新书《MSBuild技巧》中介绍过)
1>FooCompile:
1>  apa.foo
1>FooCompile:
1>  banan.foo
1>ClCompile:
1>  test.cpp
1>  main.cpp
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.