AppSettings Reader for Xamarin and Xamarin.Forms

Reading app.config files in a Xamarin.Forms Xaml project

While each mobile platforms do offer their own settings management api, there are no built in ways to read settings from a good old .net style app.config xml file; This is due to a bunch of good reasons reasons, notably the .net framework configuration management api being on the heavyweight side, and each platform having their own file system api.

So we built a simple PCLAppConfig library nicely nuget packaged for your immediate consumption.

This library makes use of the lovely PCLStorage library

This example assumes you are developing a Xamarin.Forms Xaml project, where you would need to access settings from your shared viewmodel.

You need to add the PCLAppConfig library to your pcl and all target projects.


  1. Initialize ConfigurationManager.AppSettings on each of your platform project, just after the ‘Xamarin.Forms.Forms.Init’ statement, as per below:

iOS (AppDelegate.cs)

LoadApplication(new App()); 

Android (MainActivity.cs)


Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());

UWP / Windows 8.1 / WP 8.1 (App.xaml.cs)


LoadApplication(new App());

  1. Add an app.config file to your shared PCL project, and add your appSettings entries, as you would do with any app.config file.
  1. Add this PCL app.config file as a linked file on all your platform projects. For android, make sure to set the build action to ‘AndroidAsset’, for UWP set the build action to ‘Content’
  2. Access your setting:


  1. Initialize ConfigurationManager.AppSettings on your pcl project like below:
    Assembly assembly = typeof(App).GetTypeInfo().Assembly;
  2. Add an app.config on your shared pcl project and ensure that Build Action:EmbeddedResource, and add your appSettings entries, as you would do with any app.config

The source code and demo app are available in github

What do you think?

1 Comment
April 11, 2023

Setting up cybersecurity software early in your business can protect valuable company and customer data. A great place to start is purchasing antivirus software, which guards computers and networks against viruses and other malicious attacks. You may also consider purchasing a business VPN to ensure only authorized users can access your network.

Comments are closed.

Related articles

Join Forces with Us,
Your IT Game-Changers

We are ready to address any questions you may have and assist you in finding the services that align perfectly with your specific needs.

Your benefits:
What happens next?

We arrange a call at your convenience.


We conduct an exploratory and consulting session.


You get an outstanding proposal. 

Schedule a Free Consultation