C# 在 Mac OS X 上学习 ASP.NET MVC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1888853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Learning ASP.NET MVC on Mac OS X
提问by macinjosh
I realize this is a bit insane, C# being a Windows language and all, but I want to start learning C# mostly because I'm interested in ASP.NET MVC. I work as a web developer by day and my office is completely run on *nix machines. The developers and all other staff use Mac OS X and our servers are all some variation of Linux.
我意识到这有点疯狂,C# 是一种 Windows 语言等等,但我想开始学习 C# 主要是因为我对 ASP.NET MVC 感兴趣。我白天是一名 Web 开发人员,我的办公室完全在 *nix 机器上运行。开发人员和所有其他员工使用 Mac OS X,我们的服务器都是 Linux 的一些变体。
To be honest I just want to try something different than PHP, Python, or Ruby. The catch is that I don't want to give up my beloved Mac OS X. I've looked at Mono a bit and it seems like exactly what I am looking for. Unfortunately MonoDevelop is very slow to the point of uselessness on Mac OS X. (Unless I'm doing something wrong which is entirely plausible).
老实说,我只是想尝试一些不同于 PHP、Python 或 Ruby 的东西。问题是我不想放弃我心爱的 Mac OS X。我已经看过一点 Mono,它似乎正是我正在寻找的。不幸的是,MonoDevelop 在 Mac OS X 上非常缓慢,以至于无法使用。(除非我做错了一些完全合理的事情)。
So my question boils down to this: What is the best way to code and compile C# apps on Mac OS X. (Running the code is not that big of issue, I'll probably just get some cheap server space to run my ASP.NET MVC apps on. I'm not really looking to run any apps on Mac OS X.)
所以我的问题归结为:在 Mac OS X 上编码和编译 C# 应用程序的最佳方法是什么。(运行代码不是什么大问题,我可能只需要一些廉价的服务器空间来运行我的 ASP。 NET MVC 应用程序。我真的不想在 Mac OS X 上运行任何应用程序。)
采纳答案by Min
In my own experience as a C#/Windows/ASP.Net developer the greatest strength of the platform is the integration with the tools. That said it is difficult to get it all running on mono. Mono would be an excellent deployment platform. But if you want to learnasp.net MVC your best bet is to set up a virtual Windows environment and get the free visual web developer visual studio: http://www.microsoft.com/express/vwd/.
根据我自己作为 C#/Windows/ASP.Net 开发人员的经验,该平台的最大优势在于与工具的集成。也就是说很难让它在单声道上运行。Mono 将是一个出色的部署平台。但是,如果您想学习asp.net MVC,最好的办法是设置一个虚拟的 Windows 环境并获得免费的可视化 Web 开发人员 Visual Studio:http: //www.microsoft.com/express/vwd/。
The other reason is that if you're trying to learn the platform, most resources will use some variant of Visual Studio. I find it rather difficult to try and learn a framework and have to struggle with platform differences at the same time.
另一个原因是,如果您尝试学习该平台,大多数资源将使用 Visual Studio 的某些变体。我发现尝试和学习一个框架相当困难,同时必须与平台差异作斗争。
I say this as an avid OS X user that has done C# development for several years and has done several small projects in asp.net mvc.
我作为一个狂热的 OS X 用户说这句话,他做了几年 C# 开发,并在 asp.net mvc 中做过几个小项目。
回答by jao
what about running a virtual Windows machine on your Mac?
在 Mac 上运行虚拟 Windows 机器怎么样?
回答by Omar
+1 to Min's answer.
+1 对Min 的回答。
The tools Microsoft provides (free and purchased) are amazing and integrate very well. The more I use Visual Studio, the more I love it.
Microsoft 提供的工具(免费和购买)非常棒并且集成得很好。我使用 Visual Studio 越多,我就越喜欢它。
I highly suggest doing your dev for ASP.NET/C# on Windows (bootcamp or vmware or w/e).
我强烈建议在 Windows(bootcamp 或 vmware 或 w/e)上为 ASP.NET/C# 进行开发。
Having to switch between OSes when you want to code is a small price to pay compared to the potential compatibility headaches you might face in the future.
与您将来可能面临的潜在兼容性问题相比,当您想要编码时必须在操作系统之间切换是一个很小的代价。
回答by Mr. Boy
Developing in .net is quite highly IDE-oriented. Of course you can do it all in a plain old text editor but it gets harder and harder unless you're writing back-end server code only. Maybe there are great mono-based IDEs but I can't see why you'd prefer to use MacOS when all the time will be spent using the IDE anyway.
在 .net 中开发是非常面向 IDE 的。当然,您可以在普通的旧文本编辑器中完成所有操作,但除非您只编写后端服务器代码,否则它会变得越来越难。也许有很棒的基于单声道的 IDE,但我不明白为什么你更喜欢使用 MacOS,因为无论如何都会花时间使用 IDE。
Definitely vote for virtualized Windows or using BootCamp.
绝对投票支持虚拟化 Windows 或使用 BootCamp。
回答by ZombieSheep
I'd add to the virtualisation argument. If you were to go for a Windows installation in VMWare Fusion, for example, you can run it in coherence mode. In this mode, you still get all the apps and system you know and love in OS X, and make Visual Studio appear as if tit were a native OS X app. VS, though, "sees" the Windows environment, so you get the benfits of developing on Windows.
我会补充虚拟化的论点。例如,如果您要在 VMWare Fusion 中进行 Windows 安装,则可以在一致性模式下运行它。在这种模式下,您仍然可以在 OS X 中获得您熟悉和喜爱的所有应用程序和系统,并使 Visual Studio 看起来就像是原生 OS X 应用程序。但是,VS“看到”了 Windows 环境,因此您可以获得在 Windows 上开发的好处。
Of course, you have the overhead of having two OSs competing for resources, but most of the time this is not an issue (It isn't to me, anyway, and I run my own projects at home this way on a humble MacBook)
当然,你有两个操作系统竞争资源的开销,但大多数时候这不是问题(无论如何,这对我来说不是问题,我在家里以这种方式在一台不起眼的 MacBook 上运行我自己的项目)
回答by kenny
I concur with a virtual windows machine and VS Express, but Mono Developis not that bad when especially targeting ASP.NET MVC.
我同意使用虚拟 Windows 机器和 VS Express,但是Mono Develop在特别针对 ASP.NET MVC 时并没有那么糟糕。
回答by Peter-TI
You could install a linux desktop on your mac (KDE) and use wine(a linux windows emulator app) to install Visual studio express. The KDE desktop runs on a mac. Now you do not have to install a complete windows os on your machine.
你可以在你的 mac (KDE) 上安装一个 linux 桌面并使用 wine(一个 linux windows 模拟器应用程序)来安装 Visual Studio express。KDE 桌面在 Mac 上运行。现在您不必在您的机器上安装完整的 Windows 操作系统。
回答by user783836
In case anyone ends up on this question, ASP.NET Core is now out and runs on the Mac. MS has a walkthru detailing creating a Web API with ASP.NET Core: https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-vsc
万一有人回答这个问题,ASP.NET Core 现在已经出来并可以在 Mac 上运行了。MS 有一个详细介绍使用 ASP.NET Core 创建 Web API 的演练:https: //docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-vsc