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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:34:39+00:00 2026-05-10T22:34:39+00:00

I am writing a .NET library that for various reasons cannot be registered in

  • 0

I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let’s call it SDK.dll) depends on other DLLs in order to be loaded.

When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens because although I was able to find the referenced SDK.dll, the CLR failed to load its dependencies.

The only way I found to solve the problem is to ‘Copy Local’ the SDK.dll and all its dependencies (something I can’t do because of deployment problems), or compiling my program into the same directory as SDK.dll

Is there a way to tell SDK.dll where to look for it’s dependencies regardless of its location? Maybe a SDK.dll.config file can help?

  • 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. 2026-05-10T22:34:40+00:00Added an answer on May 10, 2026 at 10:34 pm

    You can handle this at runtime by subscribing to this event:

    AppDomain.CurrentDomain.AssemblyResolve 

    It’s fired when the runtime fails to resolve an assembly. In your event handler method, write your logic to find the assembly and load it using Assembly.LoadFrom(). It would look something like this:

    public SDKClass() {   AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(FindAssembly); }  private Assembly FindAssembly(object sender, ResolveEventArgs args) {   string assemblyPath = 'c:\PathToAssembly';   string assemblyName = args.Name.Substring(0, args.Name.IndexOf(',')) + '.dll';   string assemblyFullName = Path.Combine(assemblyPath, assemblyName);    Assembly theAssembly = Assembly.Load(assemblyFullName);    return theAssembly; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a special data structure that will be available in a .NET library
I'm writing a .NET 4.0 library that should be efficient and simple to use.
I'm writing a cross-platform .NET library that uses some unmanaged code. In the static
I'm writing a DLL library that interfaces to a USB device using winusb in
Writing a .NET DLL how do I find Application.ProductName ? EDIT: Obviously, importing Windows.Forms
I am writing a .NET WinForms application that needs to display a list of
I'm writing in .NET a windows service that, at windows startup, executes some network
I'm writing a .NET command-line application that will migrate users from an existing database
I am writing a .NET 2.0 based desktop client that will send large files
I am writing a .NET 3.5 WPF application in C#. This application needs to

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.