.Net 应用程序可以转换为便携式应用程序,即单个 .exe
.Net 应用程序可以转换为单个 .exe 可移植应用程序吗?
即没有安装程序,它只是运行?
我想所有的 dll、资源等都需要嵌入到 exe 中吗?如果是这样,我该怎么做?
谢谢
Can a .Net application be converted into a single .exe portable application?
i.e. no installer, it just runs?
I imagine all the dll's, resources etc need embedding into the exe? If so, how would I do this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 ILMerge 将所有程序集合并到单个可执行文件中。但您仍然需要安装框架运行时。要将可执行文件转换为本机可执行文件,您可以查看此问题 。
You could use ILMerge to merge all assemblies into a single executable. But you still need the framework runtime installed. To turn your executable into a native executable you may take a look at this question.
否 - 您不能在自己的应用程序中静态包含 .net 运行时
No - you can't statically include the .net runtime in your own application
是的,.NET 应用程序可以是单个 .exe 文件。您可以只编写一个不依赖于 .NET 框架之外的程序集,也可以使用 ILMerge。不过,用户仍然需要安装适当版本的 .NET 框架;没有办法解决这个问题。
Yes, a .NET application can be a single .exe file. You can either only write one assembly with no dependencies outside of the .NET framework, or you can combine multiple assemblies into one using ILMerge. The user will still need the appropriate version of the .NET framework installed, though; there's no way around that.
我不确定,但听起来您希望 .NET 框架(或您的应用程序所需的部分)包含在安装程序中,以便它 100% 独立,是吗?
我知道 ClickOnce 应用程序可以下载 .NET(如果尚未安装),但如果您要部署到网络连接有限或没有网络连接的计算机,则这没有帮助。
据我了解,您可以使用您的应用程序重新分发框架:
http:// /msdn.microsoft.com/en-us/library/xak0tsbd.aspx,但我自己从未这样做过。
编辑:您的应用程序的可执行文件实际上不需要使用安装程序进行安装(如果您只需双击它就会运行),但如果您包含其他文件(例如.NET的可再发行文件),那么您可能会需要某种安装程序。
I'm not sure but it sounds like you want the .NET framework (or the parts needed for your app) to be included in the installer, so that it is 100% standalone, yes?
I know that ClickOnce apps can download .NET if it is not already installed, but that doesn't help if you are deploying to machines with limited or no network connectivity.
AS my understanding, you are allowed to redistribute the framework with your app:
http://msdn.microsoft.com/en-us/library/xak0tsbd.aspx , but I have never done it myself.
EDIT: You're application's executable does not actually need to be installed with an installer (it will run if you just double-click on it), but if you are including other files (such as redistributable of .NET) then you probably would need some kind of installer.
可以使用称为应用程序虚拟化的概念将 .net 应用程序打包到单个可执行文件中。这不是世界上最实用的事情,但它是可能的。
我在回复 时写了一些有关它的更多详细信息这篇文章。
It is possible to package a .net application into a single executable file using a concept referred to as application virtualization. It's not the most practical thing in the world, but it is possible.
I wrote some more details about it in response to this post.