Microsoft.CppClean.targets deletes the files I need
I have a VS2012 solution. One of project A generates a .h file at runtime. This header file is used by another project B. Projects A and Project B are in the same directory.
However, when Project B starts to rebuild, C: \ Program Files (x86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ V110 \ Microsoft.CppClean.targets deletes the files generated by Project A. Because of this, Project B can no longer find the file and fail.
How can I avoid deleting files during a clean build? Should the two projects be moved to a different directory?
Note that this issue does not occur in Visual Studio 2008.
source to share
Have you established the build order in the solution? It must be explicitly stated that project B depends on A, unless you use the project reference feature built into VS to directly set the dependency between the two projects.
source to share
Is this header generated in the temp ("Intermediate") directory a "build event"? If so, then Project B takes the temporary file and deletes it. This is because cleaning up project B finds the title in the temp directory, but doesn't know that it is the output of project A. Possible solutions:
- Separate the output folder from the temp folder and generate a header in the output folder.
- Keep output and temp folders together, but share the output / temp folder of project A with project B's project.
- Create a title in the custom build step instead of a build event and specify the title as the step output.
source to share