views:

1848

answers:

2

Hi

I do not understand the following things:

  1. What is the difference between app.config (applicationname.exe.config) and settings file ?
  2. I am unable to locate the *.settings file in Windows7 AppData directory under the specific account (I heard that it should be located somewhere over there) ?
  3. Let's assume that *.settings file is somewhere on the hard drive. Why on the development time the data from settings file are copied to application config file?

Kind Regards PK

A: 
  1. The app.config file represents settings intrinsic to the application, and will apply to all sessions of the application. The *.settings file is typically for settings specific to a given user's use of an application.

  2. Try looking in the Application Data directory beneath Local Settings [«username»\Local Settings\Application Data\«app name ...»], instead of the user's direct Application Data directory [«username»\Application Data].

  3. The copy of the settings in the app.config file for a given *.settings file are used to initialize it the first time those settings are used; including the case when a new setting is added and a prior copy of the *.settings file doesn't have the new setting yet.

Here is a link for a brief walk-through of settings in C#.

Using Settings in C# (MSDN)

meklarian
The problem is that settings file ain't there. There is no app directory under the: «username»\Local Settings\Application Data\ :/ I am using Windows 7.
pkolodziej
Try «username»\AppData\Local instead. This folder may be hidden, but should exist anyways. You can unset hidden items in the view for explorer.
meklarian
It is really not there! Do you know any tool which I can use to monitor where the exe file is reading from?
pkolodziej
Is this possible that settings file would be embedded into the assembly itself?
pkolodziej
Can you try opening up windows explorer and entering "shell:Local AppData" (without quotes) into the location/address? Where does it take you when you enter that path. Also, check for the company name you used to register your copy visual studio. By default, that company name will get written into your AssemblyInfo file and is used to scope the settings for applications you create.
meklarian
Sorry, one more thing. The settings file gets stored in user.config by default, not in a file named .settings . That might be throwing you off if you're looking for files with that extension.
meklarian
In general, when looking for files whose whereabouts are not obvious, Everything Search Engine (http://www.voidtools.com) does a great job. Actually, it does a great job even if you already know where the file is (it's _that_ fast)
ohadsc
+1  A: 
blak3r