views:

1240

answers:

1

We have a WPF XBAP application that we want to change the configuration on the server after it is deployed. Since the config file is embedded in the deployment files, how is this possible?

For example, we want to change the database connection strings the deployed app is connected to or we want to update the WCF service binding settings that it is connecting to? We want to update the config file on the server and not have to recompile and redeploy each time.

Thanks!

+2  A: 

In the SDK directory is a program called MageUI.exe. This program lets you create and edit application deployment manifests. You can update your config file, then use MageUI to edit your deployment manifest and import the new configuration file.

Depending on the size of your application, it may just be easier to hit Publish in Visual Studio than go through the effort of using MageUI and editing deployment manifests.

Alternately you can have your application look on your deployment server via an HTTP request for a config file (renamed to something other than .config, since ASP.NET by default blocks those files) for the updated configuration.

Adam Sills
Adam, if I were to place a file named CustomAppSettings.xml in the deployment server's source location...what method do I use to get that file into my XBAP? I'm formatting it in the same manner as an app.config file hoping I can import it into a configuraiton object and access appSettings directly. Otherwise, if I can get it into an xml object I can get the name/value pairs. I'm missing the code to get teh file into my XBAP.
FarrEver
I'm pretty sure you have access to the System.Deployment APIs when deployed as an XBAP. (Just be sure to add a reference). Use this class/property to get information about the current deployment and a URI to use as a base to load your XML file from: System.Deployment.Application.ApplicationDeployment.Current.ActivationUri
Adam Sills