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 6772239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:31:36+00:00 2026-05-26T15:31:36+00:00

The topic sort of covers my issue. I’ve seen the Best practise document about

  • 0

The topic sort of covers my issue.
I’ve seen the Best practise document about the issue, but it doesn’t really describe how to get out of the situation.
http://msdn.microsoft.com/en-us/library/dd153782.aspx

My situation.
Path A:
Main Application. (Signed, versioned. .net 3.5)
Common Interface Assembly X. (Signed, versioned)

Path B:
User Assembly.
Common Interface Assembly X. (Signed, versioned) (Potentially a different version than above. May not know the actual version, as we can’t control what the customer/user does.)

Our Main application loads a specified class from the User Assembly using reflection, and communicates with the class using a specified interface defined in the Common Interface Assembly X.
Applications have to remain in one particular path, and user (Business) assemblies in another path. Don’t ask me to change this, it’s out of my hands.

The problem is, there most likely will be a copy of the Common Interface Assembly X in Path B.
So when I load the user Assembly using reflection, it automatically loads Common Interface Assembly X from the same path, instead of using the one already loaded in memory with the Application.
I ended up with Type iXXX isn’t the same as Type iXXX, or cannot find Constructor for the User Assembly class, because again, it’s confused the interfaces between the two copies of Common Interface Assembly X.

So, how can I go about loading, and creating a class from User Assembly in Path B, but not have it load the Common Interface Assembly X from Path B (and use the one from Path A, already in memory)?

More Info:
Most problems I’m getting occur around CreateInstance, as the ClientContext is in the Common Interface Assembly X, so whilst I’ve created one from Path A, the Constructor on my dialog seems to be expecting the one from Path B. I then end up with a “Constructor on type ‘ExternalTestForms.WindowDemo1’ not found.” error.
(Even with the exact same [signed and versioned] assembly in both Path A and Path B, this error is still happening.)

I think this covers the code I’m using to load the assembly and create the custom Window using the interface.

        public IExternalForm ShowExternalWindow(string filename, string classname, string parameters, string formIdentity)
        {
            if (File.Exists(filename))
            {
                ClientContext context = GetCurrentClientContext(parameters, formIdentity);

                object dialog = null;

                AppDomain currentDomain = AppDomain.CurrentDomain;
                currentDomain.AssemblyResolve += this.CurrentDomain_AssemblyResolve;

                this.basePath = Path.GetDirectoryName(filename);
                Assembly externalAssembly = Assembly.LoadFile(filename);

                try
                {
                    // The Window must must have a ClientContext defined in the constructor.
                    dialog = externalAssembly.CreateInstance(classname, false, BindingFlags.CreateInstance, null, new object[] { context }, context.Desktop.Culture, null);
                }
                catch (Exception ex)
                {
                    // MessageBox "Could not launch the Window"
                    // LogTraceException
                }

                if (dialog != null && dialog is IExternalForm && dialog is System.Windows.Window)
                {
                    System.Windows.Window window = (System.Windows.Window)dialog;
...
...
...
                }
...
            }
        }


        private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string filename = args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll";

            // Seek out the specified assembly in the current Application path first.
            string assemblyPath = Path.Combine(Application.StartupPath, filename);

            if (!File.Exists(assemblyPath))
            {
                assemblyPath = Path.Combine(this.basePath, filename);
            }

            if (File.Exists(assemblyPath))
            {
                // Load the assembly from the specified path.
                Assembly myAssembly = Assembly.LoadFrom(assemblyPath);

                // Return the loaded assembly.
                return myAssembly;
            }

            return null;
        }
  • 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-26T15:31:36+00:00Added an answer on May 26, 2026 at 3:31 pm

    A couple of different low-impact options to consider:

    1) At application startup, copy customer assemblies only into main folder (we require our customer assemblies to have a specific naming convention in order to be loaded, so this is easy for us to implement).

    2) At application startup, delete any copies of the standard DLLs in the customer directories to prevent conflicts.

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

Sidebar

Related Questions

I've seen a few questions on this topic already but I'm looking for some
This is a topic that, as a beginner to PHP and programming, sort of
This topic has been scratched once or twice, but I am still puzzled. And
This is slightly off topic of programming but still has to do with my
Is there any sort of documentation on the topic, except of m2eclipse sources? Thanks.
hello creating a custom object may be a widely published topic, but my lack
Second question in two days on this same sort of topic. I currently am
I'm new to programming and the topic of header files is sort of bogging
This may be slightly off topic, but I cannot think of a better stack
I sort of asked this question at the end of another post but feel

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.