My build code creates one extra file in the bin folder. I want it cleaned when the solution is cleaned. However, the name of the file is determined by the AssemblyName property of the project. So, if this property is changed (rare, but happens), then the only way to have the old file cleaned is if it is written in XYZ.csproj.FileListAbsolute.txt.
Do I just write to XYZ.csproj.FileListAbsolute.txt whenever I create my file or is there a better way to do it?
OK, I found it.
Just add the file to the FileWrites item list, like this:
<ItemGroup>
<FileWrites Include="$(SomeFileYouWantCleanedUpOnClean)"/>
</ItemGroup>
In my code this is part of a target than runs BeforeBuild and BeforeRebuild, but it may as well work when defined in the global scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With