简体   繁体   English

使用.NET运行C#应用程序-MONO

[英]Running C# application with .NET - MONO

I have a simple application made using C#. 我有一个使用C#制作的简单应用程序。

Now how do I make it , such that it runs on all systems. 现在,我如何制作它,使其在所有系统上运行。 If a PC does not have .NET framework installed - it shouldsiliently install it with only the bare minimum requirements that the program needs. 如果PC未安装.NET Framework,则应仅按照程序所需的最低要求进行静默安装。 Installing .NET framework - too big in size compared to many program , which is just a few kilobytes. 安装.NET框架-与许多程序相比,它的大小太大了,只有几千字节。 Also is shoulf be silent and only if required. 也应该保持沉默,并且仅在需要时。 Basically the application should be light and capable to run in all Windows systems. 基本上,该应用程序应该轻巧并且能够在所有Windows系统中运行。 Not interested in getting to Linux users. 对接触Linux用户不感兴趣。

Should I use Mono Project. 我应该使用Mono Project。 Else is there a way to get the bare minim .NET framework selectively pre-installed. 另外,还有一种方法可以选择性地预安装裸机.NET框架。

Please advise. 请指教。

Thanks 谢谢

Have a look at mkbundle . 看看mkbundle It will create a standalone executable, with no other dependencies. 它将创建一个没有其他依赖项的独立可执行文件。 In particular it does not need neither the Mono runtime nor .NET to be installed in order to execute. 特别是它不需要安装Mono运行时或.NET即可执行。

The size might still be a problem (it will likely be several megabytes, even compressed), so there is another tool to strip out everything you don't need from the assemblies: the monolinker . 大小可能仍然是一个问题(可能甚至要压缩几个兆字节),因此还有另一个工具可以从程序集中剥离不需要的所有内容: monolinker

Note that the size will likely not reach the kilobyte range even after doing all this. 请注意,即使执行了所有这些操作,大小仍可能不会达到千字节范围。

You can do this with a lot of work and the help of the Mono framework. 您可以通过大量工作和Mono框架的帮助来完成此任务。 See Embedding Mono for more information. 有关更多信息,请参见嵌入Mono

嵌入单声道

All that considered, it would be much easier to use a boostrapper to get a version of the .NET Client Framework installed. 考虑到所有这些因素,使用boosterapper获取安装的.NET Client Framework版本会容易得多。 But you're going to lose the ability to install silently or be in the "kilobytes" footprint. 但是您将失去以静默方式安装或处于“千字节”足迹的能力。

不幸的是,您不能在未安装.NET框架的计算机上运行.NET程序,并且可以使程序的安装程序自动下载该框架,但不能在.NET中进行下载。

To run .net applications you need the .net framework installed, that should be either the full version or the limited client profile edition. 要运行.net应用程序,您需要安装.net框架,该框架应为完整版或受限客户端配置文件版。

The easiest way is to create a setup project from VS and require the .net version you want... the installer should be able to install the .net framework from the internet so you are not required to ship it with the app, which you can do by the way from the installer. 最简单的方法是从VS创建安装项目并需要您想要的.net版本...安装程序应能够从Internet安装.net框架,因此您无需随应用程序一起将其附带可以通过安装程序来完成。

Mono won't be different since it still needs to be installed on the system. Mono不会有所不同,因为它仍需要安装在系统上。 Mono however has full AOT support, but I don't have any idea whether that would help you or not... it is still a huge overkill anyway. 但是Mono具有完整的AOT支持,但我不知道这是否对您有帮助...无论如何,这仍然是一个巨大的杀伤力。

If you need your app to be small and run on ANY windows without any dependencies, you should do in c/c++ or vb6 whose runtime ships with most windows versions. 如果您的应用必须小巧并且可以在任何没有任何依赖关系的窗口上运行,则应使用c / c ++或vb6,它们的运行时随大多数Windows版本一起提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM