title: Unable to load DLL 'Yubico.NativeShims' when trying to use Yubico SDK in .NET
body: <p>I am trying to extract the X509 certificate off of my Yubikey's PIV programmatically. I am using .NET Standard 2.0 on Windows 10, and I am trying to install and use the Yubico SDK Nuget package (Yubico.Yubikey 1.3.1). After installing the package and making sure the DLLs are being copied to my bin directory, I am running my application and trying to run the example code from the SDK User Guide</p>
  <p>The first line of the example code is: <code>Dim yubikey = YubiKeyDevice.FindAll().First</code> -- however on executing this first line I am getting an exception about a DLL that cannot be loaded.</p>
  <pre><code>System.DllNotFoundException: 'Unable to load DLL 'Yubico.NativeShims': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
  </code></pre>
  <p>Sure enough, there is no Yubikey.NativeShims DLL being copied to my bin directory (although I do have a Yubico.Core.dll, a Yubico.Yubikey.dll, and a Yubico.DotNetPolyfills.dll).  Even after tracking down a copy of this missing DLL for my target platform, and putting it in the bin folder, I still get this exception.</p>
  <p>What am I missing?</p>
  <p>I have included the complete stack trace from the exception here:</p>
  <pre><code>   at Yubico.PlatformInterop.NativeMethods.SCardEstablishContext(SCARD_SCOPE scope, SCardContext&amp; context)
     at Yubico.Core.Devices.SmartCard.DesktopSmartCardDeviceListener..ctor()
     at Yubico.Core.Devices.SmartCard.SmartCardDeviceListener.Create()
     at Yubico.YubiKey.YubiKeyDeviceListener..ctor()
     at Yubico.YubiKey.YubiKeyDeviceListener.&lt;&gt;c.&lt;.cctor&gt;b__34_0()
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.LazyInitValue()
     at System.Lazy`1.get_Value()
     at Yubico.YubiKey.YubiKeyDeviceListener.get_Instance()
     at Yubico.YubiKey.YubiKeyDevice.FindByTransport(Transport transport)
     at Yubico.YubiKey.YubiKeyDevice.FindAll()
     at ClassLibrary1.Class1.Work() in C:\Users\jzylkin\source\repos\WindowsApp3\ClassLibrary1\Class1.vb:line 6
     at WindowsApp3.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\jzylkin\source\repos\WindowsApp3\WindowsApp3\Form1.vb:line 6
     at System.EventHandler.Invoke(Object sender, EventArgs e)
     at System.Windows.Forms.Form.OnLoad(EventArgs e)
     at System.Windows.Forms.Form.OnCreateControl()
     at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
     at System.Windows.Forms.Control.CreateControl()
     at System.Windows.Forms.Control.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Control.WndProc(Message&amp; m)
     at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)
     at System.Windows.Forms.Form.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Form.WndProc(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  </code></pre>
  <p>Here is the vbproj project</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;RootNamespace&gt;ClassLibrary1&lt;/RootNamespace&gt;
      &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt;
      &lt;CopyLocalLockFileAssemblies&gt;True&lt;/CopyLocalLockFileAssemblies&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Yubico.YubiKey&quot; Version=&quot;1.3.1&quot; /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>