在C#中创建可移植(非安装)Windows应用程序 [英] Creating portable (non-installing) windows applications in C#

查看:109
本文介绍了在C#中创建可移植(非安装)Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net 3.5应用程序,我想使其具有可移植性. 它很简单并且运行完美,我已经将.EXE + .DLL发送给了一些朋友,并且在同一个文件夹中同时运行带有.DLL和.ICO(我在其中使用过)的exe时,它可以按预期工作.

I have a .net 3.5 application and i'd like to make it portable. It's simple and runs perfectly, i've sent the .EXE + .DLL's to some friends and it works as intended when running the exe with the .DLL's and the .ICO (that i have used in it) along in the same folder.

我想要的很简单:创建一个单独的EXE文件,该文件无需安装即可关心dll的图像,映像以及任何我想要的东西,而无需进行安装. (又称便携式)

What i want is simple: creating a single EXE file that cares the dll's, image and whatever-i-want along with it without being a setup, and requiring no installation. (a.k.a portable)

如果需要,我可能会考虑将其迁移到.net 2.0,我不使用任何仅3.5的功能,实际上,我不确定我为什么使用3.5(无论如何我都是编程新手)

I may consider migrating it to .net 2.0 if needed, i don't use any 3.5-only functionality, in fact, i'm not really sure why i'm using 3.5 (i'm new at programming anyhow)

我想要任何提示,链接或说明,因为这样做确实很烦人,将.rar发送给我的朋友,并告诉他们在他们所谓的所有怪异文件"中提取并运行.exe. (此外,并非所有人都在文件夹中显示扩展名,所以这是一场噩梦)

I'd like any tips, links, or an explanation on how to do it, because it's really annoying sending .rar's to my friends and telling them to extract and run the .exe among all "weird files" as they call (besides, not everyone has extension display in folders, so it's a nightmare)

(我在StackOverflow中进行了搜索,但没有找到任何可以回答我所问问题的问题,我发现唯一一个类似的问题最终导致了Windows计算机中的框架可用性,语言选择和没有好的答案.)

(I have searched in StackOverflow, and haven't found any questions that answer what i'm asking, the only one that I found to be like it ended up in a discussion of framework availability in windows machines, language choosing and no good answers.)

推荐答案

您可以使用

You can use ILMerge to merge all the assemblies into your executable. I'd expect your icon to already be an embedded resource - or you should at least be able to create it as such.

定位.NET 2.0将使该应用程序具有更大的可移植性,因为它只能在仅安装.NET 2.0的计算机上工作-但我不知道2.0与3.5部署的比例如何,更重要的是它们很可能与目标受众中的部署比例 不同.

Targeting .NET 2.0 would make the application more widely portable in that it would just work on machines which only have .NET 2.0 installed - but I don't know what the proportions look like for 2.0 vs 3.5 deployment, and more importantly they may well not be the same as the proportions for deployment out of your target audience.

这篇关于在C#中创建可移植(非安装)Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆