I want a file (robots.txt) to only publish when I am using a certain build configuration. Is there a way to handle this in pre-build events?
Yes you can do this. Two things that you may need to do:
Sample code to get you started. Adjust it at will
<Target Name="AfterBuild" Condition="'$(Configuration)'=='Production'">
<Copy
SourceFiles=".../robot.txt"
DestinationFolder="..."/>
</Target>
An other option would be to use the $(ConfigurationName) macro within the VisualStudio build events editor:
if $(ConfigurationName)=="Production" copy robots.txt destinationpath
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