理解 .Net Core 和 Mono [英] Understanding .Net Core and Mono

查看:26
本文介绍了理解 .Net Core 和 Mono的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. .Net Core 中开发应用程序时,.NET 依赖项和 DLL 是否嵌入到应用程序中?这是否意味着我不需要需要在客户端 PC 上安装 .Net 依赖项?
  2. 如果我为 Linux 开发 .Net Core 控制台应用程序,是否需要在装有 Linux(客户端)的 PC 上安装 Mono?
  3. .Net core 应用程序是否与 Android 兼容?
  1. When developing an application in .Net Core, the .NET dependencies and DLLs are embedded in the application? does this mean that I do NOT need to install the .Net dependencies on the client PC?
  2. If I develop a .Net Core console application for Linux, is it necessary to install Mono on the PC with Linux (client)?
  3. Are .Net core applications compatible with Android?

推荐答案

针对您的问题:

不,依赖项没有嵌入到应用程序中(.NET 中没有静态链接).
是的,当您发布(自包含)时,依赖项会作为单独的文件添加.
如果您的应用程序是 .NET-Core 应用程序,则不需要需要安装 .NET-Core 框架.你也不需要 Mono.
您可以为每个平台进行独立部署:

No the dependencies are NOT embedded in the application (no static linking in .NET).
Yes, the dependencies are added as separate files, when you publish (self-contained).
If your application is a .NET-Core application, you do NOT need the .NET-Core framework installed. Neither do you need Mono.
You can do a self-contained deployment for each platform:

Windows-x86-32:

Windows-x86-32:

dotnet restore -r win-x86
dotnet build -r win-x86
dotnet publish -f netcoreapp2.0 -c Release -r win-x86

Windows-x86-64:

Windows-x86-64:

dotnet restore -r win-x64
dotnet build -r win-x64
dotnet publish -f netcoreapp2.0 -c Release -r win-x64

Linux-x86-32:.NET-Core 不支持

Linux-x86-32: NOT SUPPORTED BY .NET-Core

Linux-x86-64:

Linux-x86-64:

dotnet restore -r linux-x64
dotnet build -r linux-x64
dotnet publish -f netcoreapp2.0 -c Release -r linux-x64

Linux ARM(安卓/ChromeOS)

Linux ARM (Android/ChromeOS)

dotnet restore -r linux-arm
dotnet build -r linux-arm
dotnet publish -f netcoreapp2.0 -c Release -r linux-arm

Linux-arm-64:.NET-Core 不支持

Linux-arm-64: NOT SUPPORTED BY .NET-Core

这会添加所有依赖项,包括 .NET-Core 运行时库.如果使用的 DLL 引用本机 dll(它作为嵌入式资源提供),但不提供必要的 C 运行时库(例如,当本机 dll/.so 动态链接时,您仍然会遇到问题 - 例如就像在 SkiaSharp 中一样).

This adds all dependencies, including the .NET-Core runtime libraries. You can still run into problems if a used DLL references a native-dll (that it provides as embedded resource), but does not provide the necessary C-Runtime-libraries (e.g. when the native-dll/.so is dynamically linked - such as in SkiaSharp).

此外,.NET-Core 可以与 shared-framework 一起运行,这意味着部署规模较小,但必须安装 shared-framework-version,然后.

Also, .NET-Core can be run with the shared-framework, which means deployment size is smaller, but the shared-framework-version must be installed, then.

  1. 由于 Android 是 linux - 并且您没有在 x86-32 处理器或 ARM-64 处理器上运行的 Android,因此 .NET-Core 应该与 Android 兼容.我从来没有测试过这个前提.可能会带来错误.ARM 支持是粗略的.

但是,我不清楚您想在 Android 上使用 .NET Core 做什么.由于 .NET 没有实现任何 Android-UI 接口.Xamarin-Forms 可能支持带有 .NET-Core 的 Android-UI - 它当然支持单声道.但是,您可以在 Android 上运行网络/其他服务器或控制台应用程序.

However, it is unclear to me what you want to do with .NET Core on Android. Since .NET does not implement any Android-UI interfaces. Xamarin-Forms might support Android-UI with .NET-Core - it certainly does with mono. You could however run a web/other-server on Android, or a console application.

参见 CoreDroid

这篇关于理解 .Net Core 和 Mono的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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