views:

3938

answers:

6

To run my App I need

AxInterop.WMPLib.dll and Interop.WMPLib.dll

that are located in Debug and Release folder

is there any way to include those dlls into exe? so my app is available in one file only.

+12  A: 

As long as your DLLs are .NET assemblies, then ILMerge should be able to combine your exe and all of its dependencies into a single file.

Juliet
A: 

Include them as embedded. You can then extract them at run-time.

cookre
A: 

For example, add x.dll to the project and set its Build Action to Embedded Resource.

To extract:

 string AppPath=Assembly.GetExecutingAssembly().Location;
 Assembly ThisAssembly=Assembly.LoadFrom(AppPath);
 System.IO.Stream fs=ThisAssembly.GetManifestResourceStream("yourproectname.x.dll");
 int ssize=(int)fs.Length;
 byte [] buf=new byte[ssize];
 fs.Read(buf,0,ssize);
 fs.Close();
cookre
The first two lines are an unnecessary complication of "Assembly thisAssembly =Assembly.GetExecutingAssembly();". Then there is this line missing at the end: "Assembly.Load(buf);". Finally, this is a horrible solution because you can then access the loaded assembly through reflection only.
Wim Coenen
A: 

Yes, I left out the code to write the file out...

FileStream so=new FileStream("c:\\wherever\\x.dll",FileMode.Create);

so.Write(buf,0,ssize);

so.Close();

No extra utilities required.

cookre
A: 

when following the directions in you post (cookre), I get the error message:

-The name "Assembly" does not exists in the current context.-

Am I missing something?

thanks in advance.

A: 

You can use a tool like boxedapp or thinstall...

Art