title: Can I catch a missing dll error during application load in C#?
body: <p>Is it possible to catch the exception when a referenced .dll cannot be found?  </p>
  
  <p>For example, I have a C# project with a reference to a third-party dll; if that dll cannot be found, an exception is thrown. The exception is a System.IO.FileNotFoundException, but I am unable to determine where to catch it. The following code did not seem to work:</p>
  
  <pre><code>static class Program
  {
      /// &lt;summary&gt;
      /// The main entry point for the application.
      /// &lt;/summary&gt;
      [STAThread]
      static void Main()
      {
          try
          {
            // code goes here
          }
          catch (Exception exc)
          {
              MessageBox.Show(exc.ToString());
          }
      }
  }
  </code></pre>