PortableSettingsProvider is a C# implementation of SettingsProvider
for portable applications.
-
Add
src/PortableSettingsProvider.cs
to your project. -
For each setting that should be portable, set the
Provider
property to thePortableSettingsProvider
class, with a namespace qualifier if required. (By default this would bechangeme.Settings.PortableSettingsProvider
so make sure to substitutechangeme
for your namespace root.) -
Optionally, set the
Roaming
property toTrue
for global settings, orFalse
for local settings. (See Types below for an explanation.)Visual Studio currently defaults this to
False
. -
Read and write your application settings as you normally would.
Two types of settings are supported: global (roaming) and local.
Global settings are not tied to the current computer and are available to all running instances of the application, regardless of where it's running from.
Local settings are tied to the computer on which the application is running. The computer name is used as the unique identifier.
The application settings are stored in an XML file in the same directory as the application. The filename is the same as the application's executable, with the file extension settings
.
Global settings are stored in the /settings/globalSettings
node.
Local settings are stored in the /settings/localSettings/[ComputerName]
node.
Open an issue or send a pull request.