Visual-studio – Embed one DLL into another DLL In C#

dllvisual-studio-2008

I am building an Class Library application which contains some reference dlls like Skype4COM which is obviously not native object so I just wanna learn how to embed this dll into my dll showing up after building the solution.

I just don't wanna see people which dll I used when developing this application and also I don't want them struggle with skype4com.dll to import it into their projects.

P.s : to use skype4com.dll, it needs to be registered on windows by using cmd window : regsvr32.exe dllpath

So does it cause an error or is there any work-around for something.

Thanks in advance.

Sincerely.

Best Answer

Trying to hide your dependencies is a bad reason to do this, IMO. Aside from anything else, unless you obfuscate the code it'll still be visible to anyone who decompiles it with a tool such as Reflector.

Trying to make deployment easier is a good reason, however. The bad news is that for COM objects in .NET 3.5, there's no easy way round installation, as far as I'm aware.

The great news is that in C# 4.0 and .NET 4.0, there's an alternative approach which makes deployment of libraries using COM much easier. You can link the PIA instead of referencing it, which makes the compiler embed in your assembly just enough information to get at the real COM library and the types/members you use. You then don't need to ship or install the PIA.

If you can wait for .NET 4.0, that's the approach I'd take for COM PIAs, but for anything else I would just ship the library separately. Aside from anything else, the developers using your library may already be using the same class libraries you depend on: introducing two separate copies would be very confusing. If you can't wait for .NET 4.0 (or don't want to force your users to deploy it) then I'm afraid you'll have to install the COM PIA in the normal way.

Related Topic