VS 控制台应用程序 - 将所有库编译成 exe

发布于 2024-08-14 08:29:38 字数 180 浏览 2 评论 0原文

我在 Visual Studio 2008 中创建了一个基本的控制台应用程序,它引用外部程序集。

当我发布和安装项目时,可执行文件和外部程序集都安装在目标文件夹中。

是否可以编译该项目,并将所有引用的程序集包含在主可执行文件中 - 因此只有一个文件可供分发?

感谢您的帮助,

弗兰科

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

薆情海 2024-08-21 08:29:38

您可以使用 ILMerge 合并程序集以进行部署。这使您可以在开发过程中将它们分开,但在交付时将它们全部放入一个 .exe 文件中。

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.

白况 2024-08-21 08:29:38

您可以使用 ILMerge,或 Mono 项目中的 Cecil 工具。

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

謸气贵蔟 2024-08-21 08:29:38

您可以创建一个安装文件。因此您只能重新分发一个文件。
但它仍然会安装到一个文件夹中,每个程序集都是分开的。

您还可以考虑将程序集放入 GAC 中。

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.

月下凄凉 2024-08-21 08:29:38

如果您发现 ILMerge 还不够,因为您的应用程序需要 .net 程序集以外的文件,我发现使用 MakeSFX 将其打包为自解压 exe 效果很好。这听起来不太可能,但如果使用正确的命令行标志,自解压位是完全透明的,并且它的运行方式就像任何其他应用程序一样。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文