开发者

VS console app - compile all libraries into an exe

I've 开发者_StackOverflowcreated 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


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.


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜