Introductory Example
This code
Properties.Settings.Default.MyUserSettingBlah = "some new value";
Properties.Settings.Default.Save();
saves the user.config file to
C:\Users\MyUserName\AppData\Local\My_Company_Name\MyApp_Url_vb2s5kwidefdmxstmabckatcyl5t0lxd\1.0.0.0\user.config
Question
How can I save user.config to
instead of
AppData folder contains user-specific preferences and profile configurations and is further divided into three subfolders: Roaming folder contains data that can move with the user profile from a computer to a computer. Local folder contains data that cannot move with your user profile.
AppData\Roaming is where programs on your machine store data that is specific to your user account. The folder is normally hidden, and lives within your user account home folder.
The AppData folder contains all the data specific to your Windows user profile. This means that your data can be transferred from one device to another as long as you sign in with the same profile. Several apps use the AppData folder so it's easy to keep data synced between devices.
You can either access it manually or by using the "AppData" variable name. You can view the AppData folder manually by going into your Users folder, which is there in the C drive. In my case, the path is C:\Users\ADMIN . Now you should be able to see the AppData folder in your User folder.
I stumbled on this now...
As far as I know, it should be that you should put:
[global::System.Configuration.SettingsManageability(System.Configuration.SettingsManageability.Roaming)]
in Settings.Designer.cs for each settng that should go to roaming profile.
Alternatively you can change this on the Settings screen in Visual Studio 2010 by selecting the setting(s) and displaying it's properties (F4). There you can set the Roaming
property to True
.
I don't know if it's a new feature or not, but in VS2010 every setting has a property called Roaming
that can be set to true or false.
It's not visible in the Settings designer though, you have to set it in the properties window for the setting you'd like to use it on.
Setting that property to true on a setting adds
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
to Settings.Designer.cs for that particular setting, which is almost identical to what Ivan suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With