
Look at VS Text Templates, or we sometimes make use the C-preprocessor. From: Greg Keogh via ozdotnet <ozdotnet@ozdotnet.com> Sent: Tuesday, December 5, 2023 11:59 AM To: ozDotNet <ozdotnet@ozdotnet.com> Cc: Greg Keogh <gfkeogh@gmail.com> Subject: Conditional builds of arbitrary files Folks, the MSBuild process provides Condition= and #if to provide lots of control over which files and code fragments are compiled and published for a given Configuration. My projects contain increasing numbers of non-cs files like html, css, js, txt, etc which often need conditional processing, especially the equivalent of a #if to select fragments of those sorts of files for different configurations. There's no way to select fragments of arbitrary files with a #if, so I've been wondering for years about the best way to simulate the feature. I can't find any tools to do this, so I think that a custom MSBuild Task might be the way to go. The task could be given some parameters and it would edit the files and add and remove sections based upon the configuration before the build starts. Does anyone think that's a good idea? Or maybe there's a better way. Cheers, Greg Keogh