从 C# Windows 应用程序创建 .exe
我创建了一个 Visual Studio 2010 项目,它创建了一个 Windows 窗体 - 它引用了许多其他 DLL。
如何将其打包到单个 .exe 文件中?
I have a created a visual studio 2010 project that creates a windows form - it references numerous other dll's.
How can I wrap this up in to a single .exe file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
ILMerge 是您使用 /t:exe 选项寻找的内容。
示例调用如下所示:
ilmerge.exe exefile.exe [dlls-to-internalize.dll ..] /out:exefile-out.exe /t:exe
使用 ILMerge 的示例用法将多个 dll 打包成一个并将它们内部化可以在这里找到:dotlesscss buildfile
有关使用 ILMerge 的详细信息,请访问 ILMerge 网站。
您还可以通过 NuGet 通过 Chocolatey
它允许您通过重写引用将多个.NET 程序集打包到一个文件中。
如果您向某人提供库并且不希望与您内部使用的库引起依赖项冲突,您还可以内部化您的依赖项。
ILMerge is what you are looking for with the /t:exe option.
A sample call would look like this:
ilmerge.exe exefile.exe [dlls-to-internalize.dll ..] /out:exefile-out.exe /t:exe
A sample usage of using ILMerge to pack up multiple dlls into one and internalizing them can be found here: dotlesscss buildfile
More info on using ILMerge can be found on the ILMerge Website.
You can also get it through NuGet via Chocolatey
It allows you to pack multiple .NET assemblies into one file by rewriting the references.
You can also internalize your dependencies in case you are supplying a library to someone and don't want to cause dependency conflicts with libraries you are internally using.
正如发布的,ILMerge 是一个选项,另一个选项是来自 RedGate 等的“SmartAssembly”。
所有这些都不做的是内部化本机 DLL - 这是 Windows API 的限制...因此任何本机 DLL 的依赖项都必须一起提供与 EXE 一起。
As posted ILMerge is one option, another is "SmartAssembly" from RedGate etc.
What all these DO NOT do is internalizing native DLLs - that's a limitation in the Windows API... so any dependency which is a native DLL has to be shipped along with the EXE.
转到您的应用程序->bin->dubug->yourapplicationname.exe
它是自动生成的,但由于调试信息较少,发布文件夹中的 exe 比调试速度更快。
Go to Your Application->bin->dubug->yourapplicationname.exe
It is automatically generated but exe from release folder is more faster than the debug due to less information of debug.