NET框架的应用程序吗

NET框架的应用程序吗

本文介绍了您可以在Mac上安装和运行基于.NET框架的应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用/继续开发在Mac上使用.NET开发的桌面应用程序. Mac是否有可用的.NET Framework 4.0?这会允许在Mac上运行和开发基于.NET的应用程序吗?

I need to use/continue developing a desktop app developed using .NET on my Mac. Is there a .NET framework 4.0 available for Mac? Would this allow running and developing of .NET-based apps on a Mac?

我正在考虑的另一个选项是在Mac上使用Windows虚拟机.

Another option that i am considering is using a windows virtual machine on the Mac.

推荐答案

(更新本文以澄清.Net Framework和.Net Core的状况和差异-2019年10月)

细节在这里:

  • 由于 .Net Framework 在Mac或Linux操作系统上不可用,因此您不能采用针对以下目标的已编译应用程序:.Net Framework尝试使其在Mac OS上运行.

  • As the .Net Framework is not available on Mac or Linux operating systems, you cannot take a compiled application that targets the.Net Framework try to get it to run on Mac OS.

安装Mono Project运行时( https://www.mono-project.com )允许您重新编译代码并在Mac上运行,但这需要对代码库进行各种更改,因为没有更完整的.Net Framework. (也是,WPF这里也不支持应用程序.)

Installing the Mono Project runtime(https://www.mono-project.com) allows you to re-compile the codeand run it on a Mac, but this requires various alterations to the codebase,as the fuller .Net Framework is not available. (Also, WPFapplications aren't supported here either.)

解决方法可能是:

  1. 更新该应用程序的原始代码并定位.Net Core并重新编译,这意味着您最终将获得一个.Net Core应用程序,该应用程序将在具有相同代码库的多个环境中工作.

  1. Update the original code for the application and target .Net Core and recompile it, meaning you end-up with a .Net Core application, which will work in multiple environments with the same codebase.

创建原始代码的一个分支,然后重新编译以针对Mono Project框架运行.不利的一面是,您还有第二个代码分支与原始代码一起维护,这意味着更长的工作时间.

Create a branch of the original code and recompile to run targeting the Mono Project framework. Downside to this, is that you then have a second branch of code to maintain alongside the original, meaning more work longer term.

在Mac上安装运行Windows的虚拟机. (并行操作可能有助于掩盖它实际上是在Windows PC VM上运行的事实.)这从根本上解决了问题,但是以其他方式引入了更多问题,例如网络上要维护的其他VM.

Install a Virtual Machine running Windows on your Mac. (Parallels might help hide away the fact that it's actually running on a Windows PC VM.) This essentially removes the problem, but introduces more in other ways, such as another VM on your network to maintain.

我的想法:

如今,编译应用程序以在Mono上运行(并为此操作系统创建不同的代码分支")似乎似乎是一个小步,因为重新编译代码以使用.Net Core进行工作是一种更具可持续性的解决方案;相同的代码库但针对目标.Net Core进行了编译,然后在Windows,Mac和Linux操作系统上兼容.

Compiling an application to work on Mono (and therefore creating a different code 'branch' for this operating system) almost seems like a sideways step nowadays, as recompiling the code to work using .Net Core is a much more sustainable solution; the same code-base but compiled to target .Net Core is then compatible on Windows, Mac and Linux operating systems.

这篇关于您可以在Mac上安装和运行基于.NET框架的应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 02:18