title: libzmq.dll FileNotFoundException
body: <p>tl;dr Q. "how do we successfully deploy [unmanaged library] libzmq to load dynamically to support 'ZeroMQ CLR namespace' being used in a C# program?"</p>
  
  <p>C# code with NuGet pkg ZeroMQ 4.1.0.17 (Runtime version v4.0.30319; Version 4.1.0.42169) installed.  Works just fine running in the Visual Studio workspace but when deployed with the .exe in the same directory as the ZeroMQ.dll and with an amd64 subdirectory containing both libzmq.dll and libsodium.dll -- and even with copies of both those copied up into the same exec directory as program and ZeroMQ.dll -- we get:
  <code>
  Connect System.TypeInitializationException: The type initializer for 'ZeroMQ.lib.zmq' threw an exception. ---> System.IO.FileNotFoundException: UnmanagedLibrary[libzmq] Unable to load library "libzmq" from "C:\Windows\TEMP\libzmq.dll". Inspect Trace output for details. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
     --- End of inner exception stack trace ---
     at ZeroMQ.lib.Platform.Win32.LoadUnmanagedLibrary(String libraryName)
     at ZeroMQ.lib.zmq..cctor()
     --- End of inner exception stack trace ---
     at ZeroMQ.ZContext..ctor()
     at Core.Adapter.ZeroMQ.ZeroMQMessagingService.Connect(String connection_string) in \ZeroMQMessagingService.cs:line 201</code></p>
  
  <p>Note that is says it is looking in C:\Windows\TEMP but maybe that is only the last place in a chain.</p>
  
  <p>We're getting this after upgrading to ZeroMQ 4.1.0.21 and failing to load the libzmq.dll as an "embedded resource", so we removed .21 completely and returned to .17.  It had been working fine in .17 before we upgraded to .21.</p>
  
  <p>Copy If Newer is checked on the amd64\libzmq.dll and libsodium.dll and, yes, this is an x64 build attempting to run on an x64 machine.  The failing host is 2012 Server running .NET 4.5.</p>