开发者

MSBuild, clear out multiple files in a project

开发者 https://www.devze.com 2023-01-18 05:00 出处:网络
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\\licen

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.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号