can also use the copy task along with filterchain and replacetokens filter.
Here's an example:
<token key="WebConfig.EnvironmentName" value="${env_webconfig_EnvironmentName}" />
<token key="WebConfig.SMTPServerName" value="${env_webconfig_SMTPServerName}" />
<token key="WebConfig.DatabaseConnectionString" value="${env_drmportal_webconfig_DatabaseConnectionString}" />
</replacetokens>
</filterchain>
</copy>
I retain all my template files in a /config/ folder (e.g. web.config.template) and my use of the copy task replaces the values when copying to the same /config/ folder but without the ".template" file extension. I then do what's needed afterwards...\
I will admit that it is a bit cumbersome using properties in the way that you have to for this, but you have flexibility in that you can load different sets of property values by environment (e.g. local, staging, production, etc.) but that's a little more than I think you're asking.
string::replace
doesn't work<regex>
can do the job. I Need to work this out. Stay tuned... – Chausses