How can I check if a library (dll) is available in C#?

后端 未结 2 1168
感情败类
感情败类 2021-01-27 04:25

How do I check if a library (dll) is available at runtime before I call it?

相关标签:
2条回答
  • 2021-01-27 04:51

    The AppDomain.AssemblyLoad and AppDomain.AssemblyResolve events occur on load and load failure, respectively. If you handle these events you can determine which assemblies loaded and which failed.

    0 讨论(0)
  • 2021-01-27 04:56

    You can use System.IO.File.Exists to check for the file if you know where it's located.

    You can use System.Reflection.Assembly.LoadFrom to load it.

    You'll need to use reflection to call methods in the dll if you use this form of late binding.

    0 讨论(0)
提交回复
热议问题