.dll, .winmd 可以在 Unity 中读取,但不能在 XAML 项目中读取
.dll, .winmd can be read in Unity but not in XAML project
我有一个来自 this solution 的 c++ .dll
和 .winmd
。当我将它们放在 Unity 的 Plugin 文件夹中,构建 Universal Windows 项目并部署到 Hololens 2 时,.dll
和 .winmd
中的 类 被识别。
如果我创建一个 Visual Studio Universal Windows XAML 项目,将 .dll
和 .winmd
复制到项目路径并包含 .winmd
通过 Reference-Add,所有 类 在编辑过程中都存在(在编辑和构建过程中没有抛出错误)。当我构建解决方案时,.dll
也被复制到构建路径。但是,如果我部署并 运行 代码,项目将抛出以下异常:
'ResearchMode.exe' (Win32): Unloaded U:\Users\DefaultAccount\AppData\Local\DevelopmentFilesac9912-63f6-43a8-b469-6e4684f8ea08VS.Release_ARM.cwule\HoloLensForCV.dll
onecore\com\combase\objact\dllcache.cxx(2132)\combase.dll!7728B3FD: (caller: 771AC799) ReturnHr(1) tid(178) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4634)\combase.dll!771AC7B3: (caller: 771AB0A9) ReturnHr(2) tid(178) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4766)\combase.dll!771AC7CB: (caller: 771AB0A9) ReturnHr(3) tid(178) 8007007E The specified module could not be found.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Interop.dll
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我是否错误地包含了 .winmd
和 .dll
?为 Unity 项目正确加载它们而不为 XAML 项目正确加载它们的原因可能是什么?我还需要为这些程序集指定 Unity 可能已经为我完成但我不知道的其他任何事情吗?
知道了。上面的项目交付了 HoloLensForCV.winmd
、HoloLensForCV.dll
和 opencv_world3411.dll
。除了通过 Reference-Add 添加 HoloLensForCV.winmd
(将 HoloLensForCV.dll
复制到输出目录)之外,我还需要通过 Add-Existing item(选择“Copy always”)手动将 opencv_world3411.dll
添加到解决方案").
我有一个来自 this solution 的 c++ .dll
和 .winmd
。当我将它们放在 Unity 的 Plugin 文件夹中,构建 Universal Windows 项目并部署到 Hololens 2 时,.dll
和 .winmd
中的 类 被识别。
如果我创建一个 Visual Studio Universal Windows XAML 项目,将 .dll
和 .winmd
复制到项目路径并包含 .winmd
通过 Reference-Add,所有 类 在编辑过程中都存在(在编辑和构建过程中没有抛出错误)。当我构建解决方案时,.dll
也被复制到构建路径。但是,如果我部署并 运行 代码,项目将抛出以下异常:
'ResearchMode.exe' (Win32): Unloaded U:\Users\DefaultAccount\AppData\Local\DevelopmentFilesac9912-63f6-43a8-b469-6e4684f8ea08VS.Release_ARM.cwule\HoloLensForCV.dll
onecore\com\combase\objact\dllcache.cxx(2132)\combase.dll!7728B3FD: (caller: 771AC799) ReturnHr(1) tid(178) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4634)\combase.dll!771AC7B3: (caller: 771AB0A9) ReturnHr(2) tid(178) 8007007E The specified module could not be found.
onecore\com\combase\objact\dllcache.cxx(4766)\combase.dll!771AC7CB: (caller: 771AB0A9) ReturnHr(3) tid(178) 8007007E The specified module could not be found.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Interop.dll
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我是否错误地包含了 .winmd
和 .dll
?为 Unity 项目正确加载它们而不为 XAML 项目正确加载它们的原因可能是什么?我还需要为这些程序集指定 Unity 可能已经为我完成但我不知道的其他任何事情吗?
知道了。上面的项目交付了 HoloLensForCV.winmd
、HoloLensForCV.dll
和 opencv_world3411.dll
。除了通过 Reference-Add 添加 HoloLensForCV.winmd
(将 HoloLensForCV.dll
复制到输出目录)之外,我还需要通过 Add-Existing item(选择“Copy always”)手动将 opencv_world3411.dll
添加到解决方案").