首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在尝试在Yubico.NativeShims中使用Yubico时无法加载DLL 'Yubico.NativeShims‘

在尝试在Yubico.NativeShims中使用Yubico时无法加载DLL 'Yubico.NativeShims‘
EN

Stack Overflow用户
提问于 2022-04-26 13:14:36
回答 1查看 112关注 0票数 0

我正在尝试以编程方式从我的Yubikey的PIV中提取X509证书。我正在Windows 10上使用.NET标准2.0,我正在尝试安装和使用Yubico.Yubikey软件包(Yubico.Yubikey 1.3.1)。安装软件包并确保DLL被复制到bin目录后,我将运行我的应用程序并尝试运行SDK用户指南中的示例代码。

示例代码的第一行是:Dim yubikey = YubiKeyDevice.FindAll().First --但是,在执行这第一行时,我得到了一个不能加载的DLL异常。

代码语言:javascript
复制
System.DllNotFoundException: 'Unable to load DLL 'Yubico.NativeShims': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'

当然,没有将Yubikey.NativeShims DLL复制到我的bin目录(尽管我有一个Yubico.Core.dll、一个Yubico.Yubikey.dll和一个Yubico.DotNetPolyfills.dll)。即使在找到目标平台缺少的DLL副本并将其放入bin文件夹后,我仍然会得到此异常。

我遗漏了什么?

我在这里包含了来自异常的完整堆栈跟踪:

代码语言:javascript
复制
   at Yubico.PlatformInterop.NativeMethods.SCardEstablishContext(SCARD_SCOPE scope, SCardContext& context)
   at Yubico.Core.Devices.SmartCard.DesktopSmartCardDeviceListener..ctor()
   at Yubico.Core.Devices.SmartCard.SmartCardDeviceListener.Create()
   at Yubico.YubiKey.YubiKeyDeviceListener..ctor()
   at Yubico.YubiKey.YubiKeyDeviceListener.<>c.<.cctor>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& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

以下是vbproj项目

代码语言:javascript
复制
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <RootNamespace>ClassLibrary1</RootNamespace>
    <TargetFramework>netstandard2.0</TargetFramework>
    <CopyLocalLockFileAssemblies>True</CopyLocalLockFileAssemblies>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Yubico.YubiKey" Version="1.3.1" />
  </ItemGroup>

</Project>
EN

回答 1

Stack Overflow用户

发布于 2022-06-23 06:55:22

杰克,

我提出了类似的问题。我刚刚将Yubico.NativeShims.dll重命名为Yubico.NativeShims (只需删除.dll扩展),它就起作用了。

沙龙

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72014624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档