Can I catch a missing dll error during application load in C#?

后端 未结 3 1091
你的背包
你的背包 2020-12-08 19:51

Is it possible to catch the exception when a referenced .dll cannot be found?

For example, I have a C# project with a reference to a third-party dll; if that dll c

3条回答
  •  借酒劲吻你
    2020-12-08 20:41

    You can use AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

      Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
        }
    

    To manually find the assembly if it can't find it automaticaly.

提交回复
热议问题