How can I write portable Windows applications?

流过昼夜 提交于 2019-12-24 09:26:18

问题


Sometimes, I want to write an simple application which will works on any Windows machine, without installing any programs or components (ex. .NET Framework), in a C# or Java like programming language. How can I do this?

Thanks.

EDIT: Added the 'like', sorry...


回答1:


Both c# and Java require runtime libraries that have to be installed separately from the application.

You could write a standalone application using Delphi for example.




回答2:


Yes,

If you use c++ you can use more core API's like Win32, but doing this will be alot more work. Atm almost everyone is going to have .NET Framework 2 installed, if i was going to write a portable app i would base it on .NET 2.

I belive there is also apps that are written with .NET 2, that comes with the Framework dll files so it does not require the framework to be installed. I know http://www.nliteos.com used to do this, but im unable to find those versions where they did this.




回答3:


As others have suggested, you can do this if you're willing to write in C/C++ with the plain vanilla Win32 API. However, make sure you link statically to the C runtime libraries. Otherwise, your user may have an older version of these libraries and need to install the Visual Studio redistributable to get the same version you compiled against.

Alternatively, use a GCC toolchain like Cygwin or MinGW. With Cygwin you need to distribute cygwin1.dll and license your program under the GPL, but with MinGW you should be able to link dynamically and your program should run on most Windows installations.




回答4:


Your criteria are "simple application", using a "Java-like" language and "Windows machine". Given that, I think a HTA application would qualify. You can use JavaScript as your programming language and you can do anything that a stand-alone web page can do; some version of Internet Explorer (at least IE4?) is required.




回答5:


You need an development environment that can build Win32 applications with no runtime frameworks - or the framework embedded in the exe. So, managed languages are out.

The bulk of native Win32 applications are made in C/C++ using either a Microsoft toolset, or a gcc based product like Code::Blocks or Eclipse.




回答6:


I have no experience with this tool, so don't know how good or bad it is, but it is what you are looking for.

http://www.xenocode.com/products/postbuild-for-net/



来源:https://stackoverflow.com/questions/1559803/how-can-i-write-portable-windows-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!