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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:09:39+00:00 2026-05-23T14:09:39+00:00

I have a third-party library that requires an assembly A to be loaded when

  • 0

I have a third-party library that requires an assembly A to be loaded when I call into their code. That assembly is typically installed in the GAC, so I have several options to load it:

  1. I can explicitly call Assembly.Load(). However that requires the full name which I don’t feel comfortable to hard code in my program.
  2. I can explicitly call Assembly.LoadWithPartialName(). That is an obsolete API of course, and of course I don’t feel comfortable to lose control in versioning.
  3. I can reference the assembly in my Visual Studio project file, so I always get the version I built against. However, that won’t work unless I create a dummy object in that assembly. The C# compiler simply ignores it if I don’t.
  4. Same problem if I call Assembly.GetReferencedAssemblies and force load the matched one. The C# compiler simply won’t reference my assembly even if I put it in the references list.

Now what I’m doing is to call typeof(A.Foo).Assembly.GetName() and ignore the return value. Is there a better way to do it?

  • 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-23T14:09:40+00:00Added an answer on May 23, 2026 at 2:09 pm

    Option 1, for me, would be to reference it in the VS project.

    But if you want a more passive approach you can use the AppDomain.CurrentDomain.AssemblyResolve event handler. It executes when an assembly is needed that is not found in the AppDomain. The event args will tell you the Assembly that is being sought and you can go grab it at that point using Assembly.Load()

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

Sidebar

Related Questions

I have a call to a third-party C++ library which I have put into
I have a solution file that requires a third party library (open source). The
I have a third party library that I'm attempting to incorporate into a simulation.
I have a third party library that internally constructs and uses the SqlConnection class.
I have a third-party library that is sometimes throwing an exception. So I decided
I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user
I have a project I'm working on in Qt creator that requires a third-party
I have a Hudson job that just does a check-out/update to a third-party library.
We use a third-party PDF Generator library which requires that you specify the TrueType
I have an API (from third party java library) that looks like: public List<?>

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.