Need help referencing DLLs in my project.

jsunn

Member
Joined
May 13, 2009
Messages
5
Location
Milwaukee, WI
Programming Experience
Beginner
Hi all,
I'm new to VB.net and programming in general. I have a project that references two DLL files in the system 32 directory as COM references. The files are certenroll.dll and certcli.dll which are included in the system32 directory as part of the OS. My app is a console application that I'd like to have as a standalone exe. It seems that the these files are converted to something like Interop.CERTENROLLLib.dll and Interop.CERTCLIENTLib.dll and dropped in the bin directory for my project. Since I want the app to be a standalone exe able to run on other PC's I'd rather see the app reference the original DLL files in the system32 directory and not have to carry these dependency files around with it. Obvously I'm new to all this, but I'd really appreciate if someone could point me in the right direction.

Thanks!
 
Last edited:
There's no conversion taking place. Those Interop DLLs are NOT a substitute for the original COM DLLs. They are additional to the COM components and are required by your application.

COM and .NET work quite differently. A .NET assembly cannot talk to a COM component without some complex and specific code. When you reference a COM component in your app, instead of requiring you to write that code every time, the IDE bundles it up into an Interop DLL for you. When you run your app, it talks to the Interop DLL and the the Interop DLL talks to the COM component. You need both for your application to work. If the Interop DLLs are not present but the COM components are then your app will not work. If the Interop DLLs are present but the COM components aren't then your app won't work either.

This whole "standalone app" business is a bit pointless. Just distribute the Interop DLLs with your EXE, inside a ZIP file if you want a single download. Pretty much all applications these days have dependencies. That said, you may be able to use a tool like ILMerge to merge the Interop DLLs and the EXE into a single assembly. I've never tried though, so I'm not sure if there are any likely issues.
 
jmcilhinney,
Thanks for the detailed response. I'm sure this is common knowledge to most folks around here, so I appreciate you taking the time to provide a descriptive answer to a neophyte. You are right in saying that its really not too big of a deal to distribute those DLL's with the project, I was mostly looking for confirmation that there was no way around distributing them separately, versus one standalone EXE.

Thanks again,
Jsunn
 
Back
Top