views:

182

answers:

4

Hi,

I've created a basic console app in Visual Studio 2008, which references an external assembly.

When I publish and install the project, both the executable and the external assembly are installed in the target folder.

Is it possible to compile the project, and have all referenced assemblies included in the main executable - so there is only one file to distribute?

Thanks for any help,

Franko

A: 

You can use ILMerge from Microsoft for this, or the Cecil tool from the Mono project.

Oded
Cecil doesn't merge assemblies. Well, you could write a merger with it, but there's no builtin feature.
Jb Evain
+3  A: 

You can use ILMerge to merge the assemblies for deployment. This lets you keep them separate during development, but put them all into one .exe file when you ship.

Reed Copsey
Thank you - just what I was looking for!
frankie boyle
A: 

You can create a setup file. so you can redistribute only one file. But it still going to be installed into a folder with each assembly separated.

You can also consider placing your assemblies into the GAC.

ArielBH
No, the GAC would complicate things unnecessarily.
Henk Holterman
@Henk, I didn't recommend it. Just pointed out that this option is available.
ArielBH
A: 

If you find ILMerge is not enough because your app needs files other than .net assemblies, I have found that packaging it as self extracting exe using MakeSFX works nicely. It sounds unlikely but with correct command line flags the self extracting bit is completely transparent and it runs just like any other application.

DW