运行时复制异常

This article was translated from English: Does it need improvement?
Translated
View the article in English

在某些罕见情况下,由于我们特殊机器学习模型的 DLL 文件没有正确复制,会导致此错误。 下面的解决方案可以解决这个一次性错误。

IronQrDetection.Exceptions.IronQrRuntimesCopyException:机器学习 DLL 未成功从运行时目录自动复制。 这种情况可能发生在各种操作系统或框架上。 请按照以下文章中的步骤解决此问题:https://ironsoftware.com/csharp/qr/troubleshooting/runtimes-copy-exception/

解决方案

1.找到runtimes文件夹: 导航到解决方案中的runtimes文件夹。 可以在/bin/Debug/net6.0/runtimes找到(如果目标框架不同,请将Debug替换为当前配置,将net6.0替换为目标框架)。

2.复制必要文件:/runtimes/目录中,您会找到所有受支持平台和操作系统的子目录。 进入与您的操作系统相关的目录,并将必要的文件手动复制到输出目录: /bin/Debug/net6.0/

   # Example bash command to copy files on Unix-like systems
   cp /bin/Debug/net6.0/runtimes/<your-platform>/* /bin/Debug/net6.0/
   # Example bash command to copy files on Unix-like systems
   cp /bin/Debug/net6.0/runtimes/<your-platform>/* /bin/Debug/net6.0/
SHELL
   # Example PowerShell command to copy files on Windows systems
   Copy-Item -Path .\bin\Debug\net6.0\runtimes\<your-platform>\* -Destination .\bin\Debug\net6.0\
   # Example PowerShell command to copy files on Windows systems
   Copy-Item -Path .\bin\Debug\net6.0\runtimes\<your-platform>\* -Destination .\bin\Debug\net6.0\
SHELL

请确保您已更换<your-platform>选择与您的平台匹配的相应目录(例如, win-x64osx-x64linux-x64等)。

3.重建并测试: 复制必要文件后,重新构建项目以验证问题是否已解决。 现在应该已经提供了正确的 DLL 文件,机器学习模型可以正常运行了。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 51,390 | Version: 2025.11 刚刚发布