Bugzilla – Bug 575562
WriteLinesToFile does not delete file
Last modified: 2010-02-04 18:29:22 UTC
Description of Problem: In the MSBuild implementation, the WriteLinesToFile, when specifying no Lines and setting Overwrite to true, deletes the file. This detail is used in the Clean target from Microsoft.Common.Targets to delete the CleanFile if all files specified in the CleanFile have been successfully deleted. XBuild implementation does not delete the file in this case, and leaves a blank CleanFile in the OutDir after Clean. Steps to reproduce the problem: 1. Create a new target with the WriteLinesToFile with Lines empty or omitted, and Overwrite set to true OR use a project file which eventually imports Microsoft.Common.Targets 2. Execute the specified target in the build file (use the Clean target of a project that had previously executed Build on a Microsoft.Common.Targets based project) Actual Results: The file specified ($(BaseIntermediatePath)$(CleanFile) on Microsoft.Common.Targets based project) is deleted. Expected Results: The file specified exists as empty. How often does this happen? Every run. Additional Information: This functionality is required in order to fully clean projects based on Microsoft.Common.Targets. Leaving the extra CleanFile can cause issues with automated build and packaging systems.
error... I stated before $(BaseIntermediatePath), it should be $(BaseIntermeditateOutputPath)
>XBuild implementation does not delete the file in this case, and leaves > a blank CleanFile in the OutDir after Clean. I was unable to reproduce this. The clean file was not empty, it still had the old contents, even after the clean. I've fixed the two issues that you mentioned - 1. WriteLinesToFile bug (delete file on empty @Lines) 2. the CleanFile getting left around after a "Clean". It should handle incremental builds also now. Fixed in svn r150873 and r150874.