如何创建便携式应用程序(无需安装即可运行)
如何创建一个应用程序:
- 轻量级:我猜可能不需要 .NET 框架?
- 便携式:无需安装即可运行,并将数据保存在应用程序目录中,因此我可以移动文件夹甚至 exe?
这只是一个个人实验:我想尝试创建一个简单的待办事项列表应用程序,它具有
我在想的上述属性:
- C#/WPF(但需要.NET框架,我可以探索客户端配置文件)
- Appcelerator Titanium(我认为这将足够轻且足够好吗?我不知道我是否可以拥有一个便携式钛金属应用程序)
How do I create an app that is:
- lightweight: I am guessing don't require .NET frameworks maybe?
- portable: runs without installing and saves data in the app directory, so i can just move the folder or maybe even the exe?
this is just a personal experiment: i want to try create a simple todo list app that has the above attributes
I am thinking:
- C#/WPF (but requires .NET framework, I can explore client profile thogh)
- Appcelerator Titanium (i think this will be lightweight & good enough? I do not know if I can have a portable titanium app though)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果目标机器安装了.NET Framework,它几乎是可移植的。
NDepend 就是这样一个产品,它是针对 .NET 2.0 构建的,如果您之前手动安装过 .NET 2.0,则可以在 Windows Vista、Windows 7 和其他 Windows 上正常运行。
个人认为,用C++/Delphi等原生语言编写一个应用程序启动器来检测目标机器是否有.NET并不难。如果尚未安装 .NET,此启动器可以显示警告或帮助自动安装框架。 (甚至某些安装程序也允许您执行此操作。)
It is almost portable if the target machines have .NET Framework installed.
NDepend is such a product, which is built against .NET 2.0 and runs fine on Windows Vista, Windows 7, and other Windows if you manually install .NET 2.0 before.
Personally, it is not hard to write an application launcher in native languages such as C++/Delphi to detect whether the target machine has .NET. If .NET is not yet installed, this launcher can display a warning or help install the framework automatically. (Even some installers allow you to do this.)
如果你想用 C# 编写它,你要么需要 .NET 框架,要么需要 Mono 框架。不管怎样你都需要它。值得庆幸的是,.NET 2.0 非常普遍。
默认情况下,.NET 使用 xcopy 部署,因此您只需将可执行文件和任何必要的 DLL 复制到目录中即可。除非您显式创建外部依赖项,否则不需要“安装”它。
If you want to write it in C#, you either need the .NET framework or the Mono framework. Either way you need it. Thankfully .NET 2.0 is pretty ubiquitous.
By default, .NET uses xcopy deployment, so you can just copy the executable and any necessary DLLs around in a directory. It doesn't need to be "installed" unless you explicitly create external dependencies.
@jiewmeng,在这里我留下了一些构建便携式应用程序的关键
如果应用程序需要保存其他数据,例如配置文件或数据文件,则必须保存到exe应用程序的同一文件夹或应用程序的子文件夹中。
应用程序不应向 Windows 注册表或 %Appdata% 文件夹中读取/写入配置数据。
应用程序不应
避免使用像 ocx o dll 文件这样需要在系统中注册的外部依赖项。
尝试使用一种语言,使本机应用程序不依赖于framerworks,一个好的建议是使用Delphi.
如果您想使用.Net语言,请选择.Net框架版本,该版本在大多数系统中通用,例如Microsoft .Net 2.0
@jiewmeng, here i leave a few keys to build an portable application
If the application need save additional data like configuration files o data files , must be saved to the same folder of the exe application or an child folder of the application.
The application should not read/write configuration data to the Windows registry or in the %Appdata% folder.
avoid the use of external dependencies like ocx o dll files, that need to register in the system.
try to use an language wich makes native applications without framerworks dependence a good recomendation is use Delphi.
If you want to use .Net language, choose a version of .Net framework, that is in common use in most of the systems like the Microsoft .Net 2.0
使用Delphi,它总是便携且更小
Use Delphi, it's always portable and smaller