views:

18

answers:

1

I am getting the following error when trying to clear out files within my project

LC error LC0000: 'Could not find file 'E:\CI\BuildServer\RMS-Transition\Group\dev\Controls\Properties\licenses.licx'.'

My MSBuild task looks like this...

<Target Name="ClearLicenseFiles">
    <ItemGroup>
        <LicenseFiles Include="..\**\*.licx"/>
    </ItemGroup>
    <WriteLinesToFile File="%(LicenseFiles.FullPath)" Lines="" Overwrite="true"/>
</Target>

What is going on? It seems to find all of the .licx files just fine but when it goes to write to them, they don't exist... and according to the documentation the WriteLinesToFile task should create the file anyways if it doesn't already exist.

A: 

I am starting to believe that this is a bug with MSBuild... the license files are being DELETED not overwritten as you would expect. Someone else has had this issue as well (comment on bottom of this msdn article)

This is my solution... I created a file that is empty named empty.txt right next to my msbuild proj and then copied this file onto the licx files.

<Target Name="ClearLicenseFiles">
    <ItemGroup>
        <LicenseFiles Include="..\**\*.licx"/>
    </ItemGroup>
    <Copy SourceFiles="empty.txt" DestinationFiles="%(LicenseFiles.FullPath)"/>
</Target>
Jon Erickson