Skip to content

How to use System.Configuration.ConfigurationManager with Uno #17689

Answered by trydalch
trydalch asked this question in Q&A
Discussion options

You must be logged in to vote

I've got it solved. The steps are this:

  1. Set the app.config Build Action to Content
  2. Copy the config file to the ApplicationData folder
  3. Set the APP_CONFIG_FILE environment variable
  4. Force a config refresh

Here's are the essential lines of code:

// Get the config file from the app package
StorageFile sourceFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///app.config"));

// Get the destination folder (LocalFolder in this case)
StorageFolder destinationFolder = ApplicationData.Current.LocalFolder;

// Copy the file to the destination folder
destinationFile = await sourceFile.CopyAsync(destinationFolder, "app.config", NameCollisionOption.ReplaceExisting);

// Set the…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@jeromelaban
Comment options

@trydalch
Comment options

@trydalch
Comment options

@trydalch
Comment options

Answer selected by trydalch
@trydalch
Comment options

@trydalch
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants