title: Dll not loading, method not resolved error on Win10
body: <p>I am referencing one managed C++ DLL which has native C++ as refernce in my c# code.
  I am running it in VS 2019, Windows 10, when I run the program and after copying all DLLs in the build folder, I get error </p>
  
  <p><strong>FILEIOException: A procedure imported by 'xxx.dll' could not be loaded,</strong> </p>
  
  <p>hence I am not able to debug anything.</p>
  
  <p>If I just build my solution, and generated exe if I run in a machine with Window XP, it runs, also i installed VS2019 community on WinXP machine, it is also running properly.
  Project target in .net4.5</p>
  
  <p>What could be cause of dlls behaving this way?
  Should I ask dll writer to create dll in VS 2019 only he is working on VS2010?</p>
  
  <p>If exe is build on other machine and copied to Win10, it runs properly on Win10 machine.</p>
  
  <p>I suspect some Visual Studio or dll issue but not able to figure out</p>
  
  <p>Code is as below, there is one folder in all machines which have all dlls at particular loation:</p>
  
  <pre><code>static void Main(string[] args)
      {
          Initialize();
          InvokeLibrary();
      }
  
   static void Initialize()
          {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly);
          }
  
     static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
          {
              Console.WriteLine("Resolving Assembly....");
  
              String strDllName = "full path";
  
              Assembly MyAssembly1 = Assembly.LoadFile(strDllName);
  
              return MyAssembly1;
          }
  
  static void InvokeLibrary()
          {
  /// call functions in assembly
  }
  </code></pre>