6
votes

My C++ DLL (called from C# application) works fine with Debug version (main C# app in Debug ) but release version(main C# app in Release) gives The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)] System.DllNotFoundException: Unable to load DLL 'D:\TestBluRay.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F) error. I've verified all project settings and those appear to be same for both debug and release. Any idea why this fails for release version only?

1
Do you mean (1) using the debug version of the C++ DLL fails while using the release version succeeds, or (2) using the debug version of the C# application fails while using the release version succeeds?Gareth McCaughan
Is it at all possible that the release version is for some reason actually seeing an older version of the DLL? E.g., as a result of accidentally copying the DLL file only into the debug version's folder? (An easy kind of mistake to make...)Gareth McCaughan
Agree with the above commenters. Specifically, I'd check that the DLL you're referencing that is present in the bin/debug folder, is an EXACT copy of the one in the bin/release folder as well. Most likely, it's not, or it's missing altogether. Also, please edit your question and show us the full error, as displayed. ;)gravity
Some times the project dependencies doesn't rebuild everything. I normally delete the bin folder which forces a rebuild. You can check the date stamp of the .exe file to see if it has been updated.An error starting with 0x8 means there is a invalid pointer.The dll need to be in the release and debug folder. Normally when you add a reference the compile will copy the dll from source location to debug/release folder automatically. If you perform a rebuild it clears all the files from debug/release including the dll. You should never manually put add files in bin folder so they don't get deleted.jdweng

1 Answers

0
votes

Validate that the .DLL is present, and fully up-to-date between both \bin\debug (which works), and \bin\release (which is failing).

Most likely, the .DLL needs either recompiling, or simply copying in if it's a 3rd-party library.

EDIT: Your error indicates that the file may be missing entirely (DllNotFoundException), or that you're referencing a path/directory, instead of a fully qualified path name. "\Drivers\Blu_ray.." isn't a fully-qualified path name, where "C:\Windows\System32\Drivers\Blu_ray.." etc., would be a fully qualified path name.

My guess is that \bin\release\ doesn't have \drivers\blu_ray, whereas \bin\debug\ probably does have \drivers\blu_ray...