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

  • SEARCH
  • Home
  • 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 6115791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:07:56+00:00 2026-05-23T15:07:56+00:00

I have an assembly that contains classes that import a number of classes from

  • 0

I have an assembly that contains classes that import a number of classes from different assemblies that are not referenced at compile time but are discovered at runtime via a directory catalog. The exporting classes want to define custom configuration sections for the config file in the importing assembly’s host application. However, because the importing assembly’s host application does not know the exporting assemblies at compile time, it cannot load the assembly to use the custom section handler implementations in them.

One way I have found to work around this is to put the exporting assemblies in the same folder as the importing assembly’s host application assembly. But I would like to allow other developers to configure any folder they want to hold their exporting assemblies.

One thing I can do is copy the contents of the developer’s configured folder to the host’s folder on startup. But I’d rather avoid those extra moving parts and code to maintain if I can. Is there a better way around this? Is there a way to point an application to additional directories when looking for assemblies that define custom config sections?

  • 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-05-23T15:07:57+00:00Added an answer on May 23, 2026 at 3:07 pm

    I ran into the same problem while using StructureMap to discover Assemblies dynamically. The ConfigurationManager seems to look for the specified Assembly for the ConfigurationSection only in the Bin-Folder and the GAC. It doesn’t seem to work even if the Assembly was loaded into the current AppDomain.

    But the fact, that the ConfigurationSection’s Assembly is already loaded can be used for a simple workaround:

    AppDomain.CurrentDomain.AssemblyResolve += (o, args) =>
            {
                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                return loadedAssemblies.FirstOrDefault(asm => asm.FullName == args.Name);
            };
    

    The AssemblyResolve-Event is fired whenever the CLR cannot find a certain Assembly. Just ensure to register the callback before the first call to GetSection().

    Works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dll that contains a number of classes that all inherit from
I have a .NET assembly that contains classes to be registered as ServicedComponent through
I have an assembly that contains an embedded resource. However, when this assembly is
I have a .net assembly that contains data access code (a bunch of Typed
We have an assembly that is called repeatedly by different executables and it shares
I have a .NET assembly that has tens of classes and methods which are
So far i have an assembly script that lets you boot from it and
I have a .NET assembly DLL that is created on-the-fly from pre-compiled code in
I have a c# .NET assembly that gets called from a C++ COM client.
I have an assembly that contains base objects for my Business Objects, and then

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.