Question

With p4api.net, I can not load p4bridge.dll.

I can't add it as a reference to the solution without getting the following error:

enter image description here

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. (Exception from 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.

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:

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. An attempt was made to load a program with an incorrect format.

Does anyone have any experience with these issues?

Was it helpful?

Solution

You need to add a reference to p4api.net.dll - this is the .Net assembly.

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.

OTHER TIPS

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'

Hope this helps anyone who stumbles upon this question looking to solve this problem in the future!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top