Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9235335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:00:20+00:00 2026-06-18T07:00:20+00:00

How can I setup support for per (roaming) user configuration settings for a particular

  • 0

How can I setup support for per (roaming) user configuration settings for a particular plugin .DLL loaded from another application?

I have a .DLL that is loaded as add-in/plugin from another application, and want to persist configuration settings particular for this one independently of the main application that loads it, based on machine, .dll (=executable), roaming user or user profile.

I have found the System.Configuration.ExeConfigurationFileMap class that looks likely to provide what I need, but I can’t figure out how to setup the right paths specific for my (plugin) application.

What code I have so far is:

public class MyConfigurationSettings : ConfigurationSection
{
    public static MyConfigurationSettings GetSection (ConfigurationUserLevel ConfigLevel) 
    {
        string configFile = Assembly.GetAssembly(typeof(MyConfigurationSettings)).Location + ".config";
        ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
        configFileMap.ExeConfigFilename = configFile;
        configFileMap.LocalUserConfigFilename = <localUserConfigFile>; // ??? What filename to place here and how to get it based on the current environment ???
        configFileMap.RoamingUserConfigFilename = <roamingUserConfigFile>; // ???;

        System.Configuration.Configuration Config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigLevel);
        // ...
    }
}

Can anyone point me into the right direction? The available documentation and search results are too confusing or insufficient for me to get this right. Sorry , if this seems to be a silly question, but my C# (.NET) skills are going to get rusty after 4+ years not using it for earning daily bread.

I also believe it’s not primarily an issue about configuration settings management, but how to get paths for installation specific application instance configurations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:00:21+00:00Added an answer on June 18, 2026 at 7:00 am

    You set RoamingUserConfigFilename = RoamingName.config and put it under Roaming Profile:

    %AppData%\[AppName]\[Vendor]\[CodedPath]\[Version]\RoamingName.config
    

    Also you set LocalUserConfigFilename = LocalName.config and put it under Local Profile:

    %LocalAppData%\[AppName]\[Vendor]\[CodedPath]\[Version]\LocalName.config
    

    Now calling

    ConfigurationManager.OpenMappedExeConfiguration(
        exeMap,
        ConfigurationUserLevel.PerUserRoamingAndLocal);
    

    config will be read in the following order:

    Source on MSDN blogs.

    For samples search for User.config under c:\Users\[User]\AppData. Also see CP article.

    Code Sample:

    public static MyConfigurationSettings GetSection (ConfigurationUserLevel ConfigLevel) 
    {
        try
        {
            string appDataPath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string localDataPath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            System.Configuration.ExeConfigurationFileMap exeMap = new ExeConfigurationFileMap();
            exeMap.ExeConfigFilename = System.IO.Path.Combine(appDataPath, @"MyCompany\MyPlugin\Default.config");
            exeMap.RoamingUserConfigFilename = System.IO.Path.Combine(appDataPath, @"MyCompany\MyPlugin\Roaming.config");
            exeMap.LocalUserConfigFilename = System.IO.Path.Combine(localDataPath, @"MyCompany\MyPlugin\Local.config");
    
            System.Configuration.Configuration Config = ConfigurationManager.OpenMappedExeConfiguration(exeMap,ConfigLevel);
    
            return (MyConfigurationSettings)Config.GetSection("MyConfigurationSettings");
    
        }
        catch (Exception ex) {
            // ...
        }
        return null; // or throw an appropriate exception
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you setup a variable for javascript in one page and have another page
Spring ROO have built-in email support So you can setup email sending properties with
Can a cgi-bin perl script from one WAR access files in another WAR, such
I have a fairly simply In-App Purchase setup - he user can buy a
I can setup a connection manager that uses the Directory Services OLE provider and
Does anyone know of a way I can setup a VLAN for my Android
How do you setup a ViewSwitcher like the ICS Dialer has? I can setup
I'm trying to follow the instructions here ( http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest/ ) so I can setup
Can I setup Team Foundation Server in such a manner that every uer have
How can you setup an app that will ask for permission to access contacts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.