Latest / DevQuestions with Tim Corey / 130 Is Writing C# on a Mac Realistic? How About Linux?
Transcript
- 0:17SPEAKER_00: Is writing C sharp on a Mac realistic for production use?
- 0:22SPEAKER_00: Is it something I should do or should I avoid it?
- 0:25SPEAKER_00: And how about Linux?
- 0:26SPEAKER_00: Is that any better or any worse?
- 0:28SPEAKER_00: These are the questions we're asked on the suggestion site, and they're ones I think we should tackle in today's episode of DevQuestions.
- 0:35SPEAKER_00: Now, if you have a question, go to suggestions.imtimcorey.com, ask it there, and hopefully you'll see your suggestion answered in a future episode of DevQuestions.
- 0:45SPEAKER_00: So is development on the Mac okay for C Sharp developers?
- 0:50SPEAKER_00: It's something they can do, but is it really ready for prime time?
- 0:54SPEAKER_00: Is it ready for production use?
- 0:56SPEAKER_00: And the answer is yes.
- 0:58SPEAKER_00: Now there's some caveats there, we need to talk about those.
- 1:02SPEAKER_00: So let's first talk about where the best development experience will be for C sharp, and that's Windows.
- 1:09SPEAKER_00: And the reason why is because C sharp was developed originally for Windows.
- 1:15SPEAKER_00: That was the.NET framework.
- 1:17SPEAKER_00: That's basically all it focused on was Windows.
- 1:20SPEAKER_00: There was some kind of cross-platform at the edges, but mainly it was all Windows development.
- 1:27SPEAKER_00: Now.NET Core changed everything.NET Core really brought development across the platforms.
- 1:37SPEAKER_00: So now you can build an app that runs on Linux.
- 1:41SPEAKER_00: You can build an app that runs on Mac.
- 1:43SPEAKER_00: You can build an app that runs on iOS or Android or a number of different platforms, not just Windows.
- 1:51SPEAKER_00: So now we have apps that can run anywhere.
- 1:55SPEAKER_00: Can we also develop anywhere?
- 1:56SPEAKER_00: And the answer is yes.
- 1:58SPEAKER_00: So with.NET Core, you can develop on Mac or on Linux without a problem, really.
- 2:06SPEAKER_00: There's the same or similar tools for the Mac.
- 2:10SPEAKER_00: Now, Linux gets a little harder in the fact that it does not have a dedicated Visual Studio version.
- 2:16SPEAKER_00: So we have Visual Studio for Windows, the main Visual Studio, and that's the one that gets the most love.
- 2:24SPEAKER_00: That's the one that's been developed the longest and has the most features because that's where most of the work for C has been historically.
- 2:34SPEAKER_00: But now we have a broader array of operating systems we support.
- 2:41SPEAKER_00: Well, Visual Studio for Mac has gotten a lot more attention, a lot more development time, and a lot more upgrades to become closer to the experience you might get on Visual Studio.
- 2:55SPEAKER_00: It's not the same, but there is a Visual Studio for Mac that provides a lot of the same tools.
- 3:02SPEAKER_00: So we have coming parity.
- 3:04SPEAKER_00: It's not parity yet.
- 3:06SPEAKER_00: We have an improvement at least in the tools available on Mac.
- 3:10SPEAKER_00: We don't have that yet on Linux.
- 3:13SPEAKER_00: So for Linux, there is no dedicated IDE.
- 3:17SPEAKER_00: So instead, what we use is VS Code.
- 3:21SPEAKER_00: That's probably your best option for developing on Linux.
- 3:24SPEAKER_00: Now the cool thing there is that your experience, if you develop in VS Code, is pretty decent.
- 3:31SPEAKER_00: And that same experience can be had on Mac and Windows.
- 3:35SPEAKER_00: So if you want to have an identical experience across all three operating systems, you do have an option.
- 3:41SPEAKER_00: And there is support from Microsoft for the C sharp plugin for VS Code.
- 3:48SPEAKER_00: There's a lot you can do in that.
- 3:49SPEAKER_00: And it's a pretty powerful solution.
- 3:52SPEAKER_00: It's not the same as full-fledged Visual Studio.
- 3:55SPEAKER_00: It is missing some things with some IntelliCode missing and other things, but it's a pretty great experience nonetheless.
- 4:03SPEAKER_00: So there are options there, but let's talk about the limitations because this is something that people often get confused on, and we need to make sure that we clarify the limitations.
- 4:14SPEAKER_00: And the first limitation is that if you're not on Windows, you can't really develop for the.NET framework.
- 4:21SPEAKER_00: The reason why is because the.NET framework was designed for Windows.
- 4:25SPEAKER_00: It was integrated with Windows.
- 4:28SPEAKER_00: And so trying to untangle that really couldn't be done.
- 4:32SPEAKER_00: That's why Microsoft created the.NET Core, which is now, just to be clear,.NET.
- 4:38SPEAKER_00: So.NET Core and.NET, same thing.
- 4:41SPEAKER_00: So it's just that.NET Core went beyond the version four.
- 4:45SPEAKER_00: They skipped version four, but now it's five and beyond.
- 4:48SPEAKER_00: There was no.NET Framework 5, so there's no confusion there.
- 4:52SPEAKER_00: So they dropped the core from the name.
- 4:54SPEAKER_00: So now we have the ability to write anything.NET Core on Mac or Linux with another exception.
- 5:04SPEAKER_00: And that exception is WinForms and WPF and UWP, we can't build, we can't create on Mac or Linux.
- 5:16SPEAKER_00: Now you want to be clear here, you could open the project, you could create new code in there, you could save that code, you just can't build that code or run that code.
- 5:26SPEAKER_00: And the reason why, even though WinForms and WPF have.NET Core versions, even though that the reason why we can't do that on a Macron Linux is because the fact of the W in the names.
- 6:00SPEAKER_00: So even though there's a.NET Core underlying code structure, it's still tied to Windows libraries.
- 6:08SPEAKER_00: And so the question might come up, well, why'd they even go to.NET Core then?
- 6:12SPEAKER_00: Well, because.NET Core still provides a lot of benefits beyond just cross-platform.
- 6:17SPEAKER_00: It's much, much more performant.
- 6:19SPEAKER_00: It has newer features, and so on.
- 6:22SPEAKER_00: And there's a lot of companies out there that are reliant on Winforms, especially, but also WPF.
- 6:29SPEAKER_00: So those two, especially, you can't develop on anything but Windows, or at least not effectively.
- 6:36SPEAKER_00: You cannot build and run those on anything but Windows.
- 6:40SPEAKER_00: Now you heard me mention UWP, but I haven't talked more about it.
- 6:44SPEAKER_00: That's because UWP is pretty much dead.
- 6:48SPEAKER_00: It's been deprecated.
- 6:49SPEAKER_00: It's no longer being fully supported.
- 6:51SPEAKER_00: WinUI3 is moving forward, but UWP is not.
- 6:55SPEAKER_00: So just kind of forget that one.
- 6:58SPEAKER_00: Okay.
- 6:59SPEAKER_00: So that's another limitation of being on Macron Linux is that you can't build these desktop application types.
- 7:08SPEAKER_00: Now you still can build desktop applications.
- 7:10SPEAKER_00: You can build either a Blazor WebAssembly with a progressive web app.
- 7:15SPEAKER_00: That's a web desktop application.
- 7:18SPEAKER_00: Or you can build a.NET MAUI application, which is a full desktop application mostly, but it's it still run on Mac or Mac or Windows desktops.
- 7:31SPEAKER_00: It won't run on Linux yet.
- 7:33SPEAKER_00: I'm not sure if you're going to bring it to Linux yet or not.
- 7:36SPEAKER_00: We'll see.
- 7:36SPEAKER_00: So with that there are some desktop options in the Microsoft family that you can do on Mac or Linux.
- 7:45SPEAKER_00: And if you want to step outside of just the templates provided by Microsoft, you can look at Avalonia or Uno or there's some other ones out there, but those are the two big ones that provide full desktop support for Mac and even Linux using these third party packages and libraries, which they are pretty great.
- 8:09SPEAKER_00: So that's another limitation but there's still alternatives.
- 8:14SPEAKER_00: So as long as you're working with.NET Core, as long as you're not looking to build a Windows UI, you're pretty much fine.
- 8:23SPEAKER_00: Now you there is a third limitation and that is if you're trying to target IaaS internet information server, you can't do that specifically on Macro Linux.
- 8:36SPEAKER_00: You can't run IAS on macro Linux.
- 8:43SPEAKER_00: That's a Windows product.
- 8:45SPEAKER_00: And so you could use Kestrel which is the kind of equivalent web server.
- 8:50SPEAKER_00: It's not the same and that will run on Macro Linux, but you can't run IAS.
- 8:55SPEAKER_00: And so if you wanted to target specific things in IAS or test that you'd need a Windows server to test that on.
- 9:02SPEAKER_00: And the last kind of limitation to this is that your feature set for your IDE, which is Visual Studio for Mac, is going to be slower than it is for full Visual Studio.
- 9:17SPEAKER_00: Visual Studio has more of a team behind it, has a larger set of, you know, they kind of have a big head start in what it can do.
- 9:27SPEAKER_00: And Visual Studio for Mac is still trying to catch up and it's still different.
- 9:31SPEAKER_00: It behaves differently and acts differently and that's okay.
- 9:35SPEAKER_00: It's just that it's going to take some time to kind of catch up and so you're still missing some features you might get on native Windows.
- 9:42SPEAKER_00: So that's the big limitations but as long as you're doing modern development not legacy development then you should be fine using a Mac or Linux.
- 9:52SPEAKER_00: And again if you're on Linux just look at VS Code.
- 9:55SPEAKER_00: VS Code does provide a lot of great options for developing not just in C sharp but other languages as well in a very, very performant way.
- 10:05SPEAKER_00: So you can have a really performant application without a lot of horsepower on your computer.
- 10:13SPEAKER_00: You can actually have an older computer and run VS Code just great and build C sharp applications.
- 10:19SPEAKER_00: So those are the kind of limitations or the things that might hold you back a little bit when building on Mac or Linux.
- 10:26SPEAKER_00: But really yes, you can definitely use it in production.
- 10:30SPEAKER_00: Yes, you can still be a full-fledged developer that still does great things with C sharp, even though you're not on Windows.
- 10:38SPEAKER_00: All right so I hope that answers your question.
- 10:40SPEAKER_00: Thanks for asking the question and catch me in the next episode where you might see your question answered on this dev question series.
- 10:48SPEAKER_00: Thanks for watching.
- 10:49SPEAKER_00: Thanks for listening and as always I am Tim Corey.