Using sdk dll inside my application without copying and registering

I want to include all the necessary DLLs in my C # project, so you do not need to copy them to system32 and register them.

I tried with costura.fody and other ways, but I can't get it to work ...

I created the “libs” folder inside my project and I copy all the DLLs. Then I add one of these dlls (the others are dependencies, as I know) as a reference.

But I get this error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in myapp.exe Additional information: Could not retrieve COM class generator for component {00853A19-BD51-419B-9269-2DABE57EB61F} Due to the following error: 80040154 Unregistered class (Exception of HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). 

When I copy all the DLLs to my system32 folder and register one of them with

 regsvr32 %windir%\system32\zkemkeeper.dll 

everything works well...

EDIT:

As I said, sdk zkteco (biometric scanner) has several dlls. But I can add only a link. others throw me the following error:

A reference to XXX.dll could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component A reference to XXX.dll could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component .

So I don’t know what the problem is here ...

DLL:

enter image description here

My recommendation:

enter image description here

Properties of each of these libraries:

enter image description here

My folder with all dlls:

enter image description here

Properties of each of these libraries:

enter image description here

+6
source share
1 answer

After seeing the question updated and talking more with the OP regarding his specific case, I realized that my answer may not be very useful , as it stands now. Now I will leave it here if I come up with something else. :)


Using sdk dll inside my application without copying and registering

Yes, you can use isolated COM. Essentially, this means that your application can be deployed along with COM DLLs, but your manifest file does so that you do not need to register registered DLLs.

Just click the Isolated property in the COM link and this will update / create the manifest.

see also

+1
source

Source: https://habr.com/ru/post/1014700/


All Articles