How to save user.config to AppData\\Roaming folder instead of AppData\\Local?

与世无争的帅哥 提交于 2019-11-29 23:08:30
Ivan Ičin

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!