Microsoft.CppClean.targets删除我需要的文件 [英] Microsoft.CppClean.targets deletes files I need
问题描述
我有一个VS2012解决方案.项目A之一在运行时生成.h文件.此头文件由另一个项目B使用.项目A和项目B在同一目录中.
I have a VS2012 solution. One of the Project A generates a .h file at runtime. This header file is used by another Project B. Project A and Project B are in the same directory.
但是,当项目B开始重建时,C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V110 \ Microsoft.CppClean.targets删除项目A生成的文件.由于此项目B无法找不到文件,构建失败.
However when Project B starts rebuild, C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppClean.targets deletes the files generated by Project A. Due to this Project B cannot find the file anymore and build fails.
如何避免在干净的构建过程中删除文件?是否应该将两个项目移到其他目录?
How can I avoid the files being deleted during a clean build? Should the two projects be moved to a different directory?
请注意,在Visual Studio 2008中不会发生此问题.
Note that this problem does not occur in Visual Studio 2008.
推荐答案
此标头是由构建事件"在temp(中间")目录中生成的吗?如果是这样,则Project B假定它是一个临时文件,然后将其删除.这是因为项目B的清理工作在temp目录中找到了标头,但不知道它是项目A的输出.可能的解决方案:
Is this header generated in the temp ("Intermediate") directory by a "Build Event"? If so, then Project B assumes it's a temp file and deletes it. This is because project B's cleanup finds the header in the temp directory but doesn't know that it's an output of Project A. Possible solutions:
- 将输出文件夹与temp文件夹分开,并在输出文件夹中生成标题.
- 将输出和临时文件夹保留在一起,但将项目A的输出/临时文件夹与项目B的分开.
- 在自定义构建"步骤而不是构建事件"中生成标题,并将标题指定为步骤的输出.
这篇关于Microsoft.CppClean.targets删除我需要的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!