Bug 575562 - WriteLinesToFile does not delete file
Summary: WriteLinesToFile does not delete file
Status: RESOLVED FIXED
Alias: None
Product: Mono: Tools
Classification: Mono
Component: xbuild (show other bugs)
Version: SVN
Hardware: Other Other
: P5 - None : Normal
Target Milestone: ---
Assignee: Jain Ankit
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: easy_fix
Depends on:
Blocks:
 
Reported: 2010-01-30 14:44 UTC by Jeffrey Richardson
Modified: 2010-02-04 18:29 UTC (History)
1 user (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: No
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Richardson 2010-01-30 14:44:07 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.
Comment 1 Jeffrey Richardson 2010-01-30 14:53:23 UTC
error... I stated before $(BaseIntermediatePath), it should be $(BaseIntermeditateOutputPath)
Comment 2 Jain Ankit 2010-02-04 18:29:22 UTC
>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.