views:

248

answers:

2

I'm deploing an applicaiton using ClickOnce, the problem is that the configuration file (xxx.exe.config) is not embedded in the package and there is no option to include it. Another problem with the config is that When I'm trying to manually write it to the directory where it is delopyed (Environment.CurrentDirectory) I'm getting an exception - I have no permissions to do that.

Any ideas on how to deploy the app along with the configuration file? (and to make it writable, because the applications during ti's runtime alters the config values)

Thanks in advance

+1  A: 

When you click on the Properties of your project and go to the Publish tab of the project's properties, click Application Files... then check the 'Show All Files' checkbox. You should see an option to choose your applications config file from there.

In my experience the <*>.exe.config file is usually set to include automatically however.

Anthony Shaw
+2  A: 

The config file should get published automatically; if not, ensure that it is configured to copy to output, and (if that fails) check the publish files (project properties -> publish -> application files; the config file should be marked as "include (auto)" or "include").

You shouldn't attempt to update anything in the app install directory. That is a bad idea generally (since you can't assume you can update "program files" unless you're an admin), but the same holds true for ClickOnce too.

Just create a settings file with some user settings; these will be saved in the user's profile, so can be updated reliably. You can't edit the files deployed via ClickOnce; even if you had access, it would (by default) break the hashing function, and it will refuse to load them. You can turn off the hashing, but... this still isn't a great idea.

Marc Gravell