?
Solved

How to determine if assembly exists before attempting load using Reflection

Posted on 2011-03-13
4
Medium Priority
?
843 Views
Last Modified: 2012-05-11
We are using Reflection to load an assembly when an application first starts up.  How would I determine if the assembly exists before executing Reflection.Assembly.Load?
0
Comment
Question by:MEINMEL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 35123526
What type of assembly are you trying to load?  Is it stored in the GAC, or a separate DLL?  If it is a separate DLL, you should be able to use System.IO.File.Exists(path) to find out if the file exists.  
0
 

Author Closing Comment

by:MEINMEL
ID: 35129666
That's what I was originally going to do - I just wondered if there was another option.  Thanks
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35129709
You could attach a handle to AppDomain.CurrentDomain.AssemblyResolve, which is called when the assembly can't be found, so that you can provide the assembly, but that is a different approach than what you are describing.
0
 

Author Comment

by:MEINMEL
ID: 35129724
Thank you very much!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question