.NET - Including dependencies

Slid

Member
Jul 5, 2004
33
0
0
Hey,

I've been working on a little program at work and it is nearing the finished stage but I am having a little issue including .dll files. I am making use of Shell32.dll but for some reason when I run the .exe it bombs out because it can't find the library. I don't want to make an installer for the program - I'd rather it be just one file, a done deal.

Is there any way to INCLUDE a .dll in the .exe itself? I know this would make the .exe a bit larger (but the included functions are only 54kb) but I want to do it anyways.

I can't seem to find any information on this.

Thanks!

Edit: Excuse me - when I say dependency I mean "Reference" :)

In my references box it calls my .dll "Interop.Shell32"
 

Slid

Member
Jul 5, 2004
33
0
0
Okay - I've managed to include the .dll as an embedded resource by going to Project->Add Existing Item. It has increased my .exe filesize by 54kb :) I thought I was the champion until I ran the program and got the same error. It is like .NET doesn't pay attention that the .dll is embedded. There must be some type of command to make it see it but I'm not quite sure what that is.

I am using VB .NET by the way.

Thanks in advance.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
DLLs must be external to the EXE at the time they are loaded, only LIBs actually get linked into the EXE.

You could possibly make this work by including the DLL in the EXE, then extracting it at run time, but then you must also load the DLL explicitly with LoadLibrary, and bind to functions with GetProcAddress.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
you're best bet would be to create a deploy project, it automatically includes dependencies, and if not you can add your own.