title: Could not load file or assembly 'XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies
body: <p>I have been trying to debug this Error:</p>
  
  <blockquote>
    <p>System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'</p>
  </blockquote>
  
  <p>I see a lot of solutions out there and try them all.</p>
  
  <p>I am looking at Fusion Viewer and I am getting the following message:</p>
  
  <blockquote>
    <p>LOG: This bind starts in default load context.
    LOG: Using application configuration file: I:\Projects\ACE Explorer\AceV_1Explorer\AceExplorer\AceExplorer\bin\Debug\AceExplorer.exe.config
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    LOG: GAC Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///I:/Projects/ACE Explorer/AceV_1Explorer/AceExplorer/AceExplorer/bin/Debug/ClassLibrary1.DLL.
    LOG: Attempting download of new URL file:///I:/Projects/ACE Explorer/AceV_1Explorer/AceExplorer/AceExplorer/bin/Debug/ClassLibrary1/ClassLibrary1.DLL.
    LOG: Attempting download of new URL file:///I:/Projects/ACE Explorer/AceV_1Explorer/AceExplorer/AceExplorer/bin/Debug/ClassLibrary1.EXE.
    LOG: Attempting download of new URL file:///I:/Projects/ACE Explorer/AceV_1Explorer/AceExplorer/AceExplorer/bin/Debug/ClassLibrary1/ClassLibrary1.EXE.
    LOG: All probing URLs attempted and failed.</p>
  </blockquote>
  
  <p>I see the file in the directory and the Target framework is 4.0 for all using x86</p>
  
  <p>Any ideas of finding out what is broken</p>
  
  <p><strong>Updated</strong>
  Sorry for the confusion.  In the log it was PublicKeyToken=null.  I was trying everything.</p>
  
  <p><strong>UPDATE</strong>
  I added some code in the main program that will resolve assemblies using the ResolveEventHandler.  It didn't work at first. But when I had the program load those external assemblies (LoadReferences()) in the start of the program it do work. Weird since the path was exactly the same when I load them in the beginning LoadReferences() and then when the method enters a reference to a custom assemble which triggers the CurrentDomain_AssemblyResolve.  The blank path resolves to the assemblypath. As you can see, in the LoadReferences(), I am adding EntityFramework which will cause the same issue, even though I am using Nuget.</p>
  
  <p>In Main() I added:</p>
  
  <pre><code>AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
  LoadReferences();
  
  
  
  private static void LoadReferences()
          {
              Assembly  objExecutingAssemblies;
              objExecutingAssemblies = Assembly.GetExecutingAssembly();
              AssemblyName[] arrReferencedAssmbNames = objExecutingAssemblies.GetReferencedAssemblies();
              Assembly asm;
              foreach (AssemblyName strAssmbName in arrReferencedAssmbNames)
              {
                  if (strAssmbName.FullName.ToLower().Contains("[company].") || strAssmbName.FullName.ToLower().Contains("entityframework"))
                      asm = Assembly.LoadFrom(Path.Combine("", strAssmbName.FullName.Substring(0, strAssmbName.FullName.IndexOf(","))+ ".dll"));
  
  
              }
              // these were also posing an issue
              asm = Assembly.LoadFrom(Path.Combine("", "EntityFramework.dll"));
              asm = Assembly.LoadFrom(Path.Combine("", "EntityFramework.SqlServer.dll"));
  
  
          }
          static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
          {
              string assembliesDir = "";
              try
              {
                  string dll = (args.Name.IndexOf(",") &lt; 0 ? args.Name + ".dll" : args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll");
                  Assembly asm = Assembly.LoadFrom(Path.Combine(assembliesDir, dll));
                  return asm;
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.Message);
              }
  
              return null;
          }
  </code></pre>
  
  <p>Also. Not sure if this makes a difference but it is a clickonce with full trust.  </p>
  
  <p>Also our desktops are pretty locked down.  </p>
  
  <p>Also platform is set to x86 for all projects. </p>