简体   繁体   English

使用p4api.net,我无法加载p4bridge.dll

[英]With p4api.net, I can not load p4bridge.dll

With p4api.net, I can not load p4bridge.dll. 使用p4api.net,我无法加载p4bridge.dll。

I can't add it as a reference to the solution without getting the following error: 没有出现以下错误,我无法将其添加为解决方案的参考:

在此处输入图片说明

If I don't include it, I get the following runtime exception: 如果不包含它,则会收到以下运行时异常:

Test method CFTT.Business.Test.GeneralTests.ddddd threw exception: System.DllNotFoundException: Unable to load DLL 'p4bridge.dll': The specified module could not be found. 测试方法CFTT.Business.Test.GeneralTests.ddddd引发异常:System.DllNotFoundException:无法加载DLL'p4bridge.dll':找不到指定的模块。 (Exception from HRESULT: 0x8007007E) (来自HRESULT的异常:0x8007007E)

If I manually copy the the dll to the build output directory without explicitly referencing it I also get get the above error, though I'm running this threw the unit test, so it may be a side path-ing issue. 如果我在没有显式引用的情况下将dll手动复制到生成输出目录,尽管我正在运行此引发单元测试,但也会得到上述错误,因此这可能是侧面路径问题。

The above is with the 32 bit, if I try to use the 64 bit (which I would rather), I also get the same error with the p4bridge.dll but at run time, I get: 上面是32位的,如果我尝试使用64位(我希望这样做),则p4bridge.dll也会出现相同的错误,但是在运行时,我得到:

Test method CFTT.Business.Test.GeneralTests.ddddd threw exception: System.BadImageFormatException: Could not load file or assembly 'p4api.net, Version=2013.2.66.1822, Culture=neutral, PublicKeyToken=f6b9b9d036c873e1' or one of its dependencies. 测试方法CFTT.Business.Test.GeneralTests.ddddd引发异常:System.BadImageFormatException:无法加载文件或程序集“ p4api.net,版本= 2013.2.66.1822,文化=中性,PublicKeyToken = f6b9b9d036c873e1”或其依赖项之一。 An attempt was made to load a program with an incorrect format. 试图加载格式错误的程序。

Does anyone have any experience with these issues? 有人在这些问题上有经验吗?

You need to add a reference to p4api.net.dll - this is the .Net assembly. 您需要添加对p4api.net.dll的引用-这是.Net程序集。

p4bridge.dll is a native COM enabled library, which I believe needs to be in the same directory but does not need to be referenced directly from your code. p4bridge.dll是一个本机启用COM的库,我相信它需要位于同一目录中,但不需要直接从您的代码中引用。

I've posted a solution for this issue that allows you to build p4api.net using the Any CPU target and have it automatically work on both x86 and x64 architectures: Building p4api.net.dll for 'Any CPU' 我已经发布了针对此问题的解决方案,该解决方案使您可以使用Any CPU目标来构建p4api.net并使它自动在x86和x64体系结构上运行: 为'Any CPU'构建p4api.net.dll

Hope this helps anyone who stumbles upon this question looking to solve this problem in the future! 希望这对遇到这个问题的人有所帮助,希望将来解决该问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM