问题描述
我们目前正在测试 Mono,看看我们的 .NET DLL 是否适用于 Linux 上的客户.我们的 DLL 为 Windows 窗体提供组件.我将 DLL 放在 Debug 目录中,添加了引用,并创建了一个派生自 Windows 窗体的类.该类独立运行良好,但在我添加 DLL 引用并创建我们的一个组件后(智能感知工作正常),它编译但不会运行:
** (/home/aldwin/testMonoWF/testMonoWF/bin/Debug/testMonoWF.exe:26905): 警告 **: 无法加载文件或程序集 'OUR.ASSEMBLY, Version=1.0.0.1, Culture=neutral, PublicKeyToken=ATOKEN' 或其依赖项之一.未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集OUR.ASSEMBLY,版本=1.0.0.1,Culture=neutral,PublicKeyToken=ATOKEN"或其依赖项之一.文件名:'OUR.ASSEMBLY,版本=1.0.0.1,文化=中性,PublicKeyToken=ATOKEN'我查看了程序集的属性,它是具有该公钥的版本.
有没有办法让我使用这些 DLL?我做错了什么?
根据 MoMA 的说法,除了一些与情况无关的 [MonoTodo] 之外,其中三个 DLL 存在一个问题:
调用方法 |P/调用方法 |P/调用库void OnHandleCreated (EventArgs) |int GoText/ComboBoxControl.SetWindowTheme (IntPtr, string, string) |文件主题.dll但是,我打开了我们用 VS2008 创建的示例项目之一,将 DLL 的引用指向了正确的位置,并且它运行良好.但是我无法获得在新项目中工作的参考.我做错了什么吗?
编辑 2:澄清一下,我们不想重新创建现有的 Windows 应用程序 - 我们正在模拟客户使用我们的 dll 创建一个新应用程序.我只是在测试它是否是一个dll问题.由于VS制作的应用程序能够找到dll并成功运行,因此看起来不是dll问题.新应用程序不会调用 VS 创建的应用程序不会调用的任何内容.
我会用 MOMA (Mono迁移分析器),看看它是否使用了不受支持的 API.
We're currently testing Mono to see if our .NET DLLs will work for customers on Linux. Our DLLs provide components for Windows Forms. I placed the DLLs in the Debug directory, added the references, and created a class deriving from a Windows Form. The class had run fine standalone, but after I added the DLL references and created one of our components (the intellisense worked fine), it compiles but will not run:
** (/home/aldwin/testMonoWF/testMonoWF/bin/Debug/testMonoWF.exe:26905): WARNING **: Could not load file or assembly 'OUR.ASSEMBLY, Version=1.0.0.1, Culture=neutral, PublicKeyToken=ATOKEN' or one of its dependencies. Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'OUR.ASSEMBLY, Version=1.0.0.1, Culture=neutral, PublicKeyToken=ATOKEN' or one of its dependencies. File name: 'OUR.ASSEMBLY, Version=1.0.0.1, Culture=neutral, PublicKeyToken=ATOKEN'
I looked at the properties of the assembly, and it is that version with that public key.
Is there a way for me to use these DLLs? What am I doing wrong?
EDIT:
According to MoMA, other than some [MonoTodo]s that have no bearing on the situation, there is one problem in three of the DLLs:
Calling Method | P/Invoke Method | P/Invoke Library void OnHandleCreated (EventArgs) | int GoText/ComboBoxControl.SetWindowTheme (IntPtr, string, string) | uxtheme.dll
However, I opened one of our sample projects created with VS2008, pointed the reference to the DLL at the right place, and it worked fine. But I could not get the reference to work in a new project. Am I doing something wrong?
EDIT 2:To clarify, we don't want to recreate an existing windows application - we are simulating a customer creating a new application with our dll. I was just testing that to see if it was a dll problem. Since the VS-made application was able to find the dll and run successfully, it would seem it's not a dll problem. The new application is not calling anything the VS-created application doesn't.
I'd test the DLL with MOMA (Mono Migration Analyzer) to see if it's using unsupported API's.
这篇关于在 Mono 中使用预编译的 .NET 程序集 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!