Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
Error handling Reference DLL not found
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="kndg, post: 13610175"] Hi Sig, You can't catch the above exception because the exception is thrown during assembly binding process (before your Main method ever executed). If you want to catch this exception, you can do it through late binding (which involves Reflection) or by loading your executable through another Application Domain. Reflection is fairly complex for such a simple purpose, so I show you the second method instead; public class ApplicationWrapper { public static void Main(string[] args) { AppDomain newDomain = AppDomain.CreateDomain("My Domain"); try { newDomain.ExecuteAssembly("Path to your executable"); } catch (System.IO.FileNotFoundException) { Console.WriteLine("Required assembly not found!"); } } } Regards. [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
Error handling Reference DLL not found
Top