trampster
trampster

Reputation: 8918

Where does mono put app.config

I have a winforms app which has an app.config.

If the config file is not present it is automatically generated. However it is not generated in the directory that the app is running from. I can't find it anywhere.

I know it is generated because my setting are persisted as expected.

So where has mono put it.

(running on ubuntu 10.04) mono 2.4.

It seems that on windows a deleted .config file is not regenerated (I get an error) until I do a rebuild, But on mono it quite happily continues saving my settings after I delete the config file.

Upvotes: 3

Views: 2696

Answers (4)

Caius Jard
Caius Jard

Reputation: 74710

When I recently had this question. I found it in ~/.local/share/MyCompanyName/MyAppName_RANDOM_NUMBER_HERE/user.config (but note, it was empty. See my answer here for more info on what I did to get it working (i.e. to have content and save correctly)

Upvotes: 0

Lex Li
Lex Li

Reputation: 63299

I guess you use relative path to determine the existence of the config file. Then on Linux the process executing your code is mono.exe, and it may reside in a completely different folder from your binaries, and the config file may be written to an unknown position.

Besides, your description of the problem is really ambiguous. Next time you may use step by step way and separate what happens on Windows from what happens on Linux.

Upvotes: 0

jpobst
jpobst

Reputation: 9982

Most times on Linux, the user does not have write access to the location of the binary.

I would look for it somewhere in your home directory, probably in ~/.config.

Upvotes: 3

Andrew Hare
Andrew Hare

Reputation: 351698

Check the output directory - by default the application configuration file is emitted to the same directory as the assembly.

Upvotes: 0

Related Questions