.NET Speichern von Konfigurationseinstellungen zu PerUserRoaming Ort
-
09-10-2019 - |
Frage
Ich habe eine VS2010-Lösung mit einer Settings.settings Datei. Die Benutzereinstellungen werden auf die lokalen Einstellungen gespeichert Ordner und das ist ein Problem, da diese Einstellungen nicht roam tun.
Zur Zeit der Einstellungsdatei gespeichert wird automatisch an:
Dim config_initial As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal)
Console.WriteLine("Local user config path: {0}", config_initial.FilePath)
(C:\Documents and Settings\%username%\Local Settings\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config
)
Gibt es eine Möglichkeit, diese Datei zu dem Dateipfad durch identifiziert zu speichern:
Dim config_new As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoaming)
Console.WriteLine("User config path: {0}", config_new.FilePath)
(C:\Documents and Settings\%username%\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config
)
Ich spare gerade My.Settings.Save()
oder automatisch, wenn die Anwendung beendet werden zur Zeit.
Lösung
fand ich die Antwort hier . In Visual Studio, öffnen Sie den Bildschirm Anwendungseinstellungen, dann eine individuelle Einstellung auswählen, und dann auf die Eigenschaften-Fenster gehen. Es gibt dann eine Option Roaming
zu True