tags:

views:

642

answers:

2

I have a development app.config and a deployment app.config. I need clickonce to change it on deployment.Is this posible to be done automatically?

A: 

If you are using the VS tools, then the config files are all part of the signed portion of the deployment. As such, the best way to do this is via your build tools - i.e. build a different version with dev/live/etc config files.

With 3.5SP1 you can opt out of the signing; I don't know if you can do this via the IDE - presumably you can do it if you do it manually (via mage), but this is a lot more work...

Marc Gravell
It can be done with Mage, but we generally opt for different build versions. As Marc says, it's simpler.
Mitch Wheat
+1  A: 

An easy way would be to copy the app.config file in the pre-build script that you can define in the app's property page Build events.

You could do either:

1) Create a solution config used only for deploying to production, and switch on that in the script, e.g.

if  ($(ConfigurationName)) == (PublishConfig) call ReplaceAppConfig.cmd

or, if you only build the publish config on a specific machine:

2) Always run the script in the pre-build event:

call CheckAndReplaceAppConfig.cmd

and the CheckAndReplaceAppConfig.cmd would in this case have:

IF (%MACHINENAME%)==(PUBLISH_SERVER) ReplaceAppConfig.cmd
andyhammar