I assume that you want to do this so that the connection string points to the production environment, and not to the development or testing environment when Nant builds the release code. I usually have a different approach to solving this scenario; save the connection strings in a separate file. You can do this using the configSource
attribute:
<connectionStrings configSource="connections.config"></connectionStrings>
The connections.config
file should look something like this:
<?xml version="1.0"?> <connectionStrings> <add name="myDb" connectionString="{your connection string}"/> </connectionStrings>
Since connection strings rarely change in a production environment, then the connections.config
file can usually be excluded from deployment.
Fredrik MΓΆrk
source share