Configuring ClickOnce Deployment - Configuration Files

I am deploying an application using ClickOnce, the problem is the config file (xxx.exe.config) is not built into the package and there is no way to enable it. Another configuration issue is that when I try to manually write it to the directory where it ended (Environment.CurrentDirectory), I get an exception - I don't have permission to do so.

Any ideas on how to deploy the app along with the config file? (and make it writable because applications change configuration values ​​at runtime ti.)

Thank you in advance

+2


source to share


3 answers


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

You should not try to update anything in the application installation directory. This is generally a bad idea (since you cannot assume that you can update "program files" if you are not an administrator), but the same is true for ClickOnce.



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

+2


source


You can also change the build action for the files you want to include in your ClickOnce deployment: Properties for a file β†’ Build Action β†’ set to "Content"

this will add the file to the list Application files

in Publish

the project options.



If you need to publish a file from a referenced project, I didn't find a better solution Add β†’ Existing Item β†’ On "Add" button, select "Add as Link"

, and then set the action to Content

and looked at the list of published files.

+5


source


When you click your Project Properties and go to the Publish tab of the project properties, click Application Files ... then select the Show All Files checkbox. You should see an option to select the application config file from there.

In my experience, the <*> .exe.config file is usually installed automatically, however.

+1


source







All Articles