can also use the copy task along with filterchain and replacetokens filter .
Here is 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 save all the template files in the / config / folder (for example, web.config.template), and my use of the copy task replaces the values ββwhen copying to the same / config / folder, but without the ".template" extension. Then I do what I need afterwards ... \
I admit that it is a bit cumbersome, using properties the way you need it, but you have the flexibility that you can load different sets of property values ββacross environments (e.g. local, setting, production, etc.) but it is a little more than I think you ask.
source share