how to change default path for Properties.Settings

2019-04-10 22:21发布

问题:

Whenever I do Properties.Settings.Save(), it commites the properties changes to Application.LocalUserAppDataPath but I want the path to be Application.CommonAppDataPath.

where

Application.CommonAppDataPath = 
C:\Documents and Settings\**All Users**\Application Data\xxxxx\xxxx\1.0.0.0


Application.LocalUserAppDataPath =
C:\Documents and Settings\**gsankar**\Local Settings\Application Data\xxxxx\xxxx\1.0.0.0

Please let me know whether it's possible to change. If so, please let me know how?

回答1:

use Properties.Settings.Default.ParentPath = Application.CommonAppDataPath; before calling Properties.Settings.Save();.