Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using dlls of sdk inside my app without copy and register

I want to include all the needed dll´s inside 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 cant get it work...

I created a "libs" folder inside my project and I copy all the dll´s. Then I add one of this dll (the other 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

all works well...

EDIT:

As I said the sdk of zkteco (a biometric scanner) has multiple dll. But I only can add one as reference. the others throws me the next 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.

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

The dll's:

enter image description here

My reference:

enter image description here

Properties of each of this libs:

enter image description here

My folder with all dll's:

enter image description here

Properties of each of this libs:

enter image description here

like image 661
MartaGom Avatar asked Nov 09 '22 02:11

MartaGom


1 Answers


After seeing the update to the question and chatting more with OP regarding his specific case, I've come to realise that my answer may not be very useful as it currently stands. I'll leave it here for now in case I think of anything more. :)


Using dlls of sdk inside my app without copy and register

Yes you can use Isolated COM. Essentially it means Your app can be deployed along with the COM dlls but your manifest file makes it so you don't need to have the COM dlls registered.

Simply click the Isolated property on the COM reference and this updates/creates the manifest.

See also

  • COM Interop, isolation and excluding duplicate references
like image 116
MickyD Avatar answered Nov 14 '22 23:11

MickyD