I’ve been working on a small .NET Core project over the past two months (you can see the beginnings of it here), giving me ample opportunity to try out Microsoft’s newest tools for building .NET Core applications. I’ve tried Visual Studio Code, Visual Studio 2017 and Visual Studio for Mac. After experimenting with all three, it’s pretty clear that Visual Studio 2017 on Windows is still the best .NET development experience today.
Let’s clarify some naming to distinguish between the three products. Visual Studio 2017 (VS2017 for short) is the full-fledged IDE that developers have used on Windows for years. Visual Studio Code (VSCode for short) is marketed as a code editor for building modern web and cloud applications. Finally, there’s Visual Studio For Mac (or VSMac for short), which attempts to be a wholesale replacement for VS2017 on macOS. Check out Scott Hanselman’s run-down of all the options available to develop .NET Core applications, which isn’t limited to Microsoft’s tooling.
I’ve been a Mac user at home for years now and I’d been looking forward to seeing how .NET development faired on a more Linux-y environment compared to the more traditional Windows experience. I started the project on VS Code, building out the applicatio and the unit tests layer with it. I then switched to Visual Studio for Mac to write acceptance tests. And finally, I went back to the familiar confines of Visual Studio 2017 to finish off the project when VSMac’s experience wasn’t quite what I expected it to be.
VSCode can’t replace VS2017
VSCode is built with an extension model in mind. So inevitably, the first part of working with it is finding the best extensions to make your experience as seemless as possible. I wrote an entire post dedicated to the extensions that I ended up using to make my experience as close as possible to Visual Studio 2017.
Omnisharp is a wonderful extension that also gave me some inconsistent results. It required frequent restarts (Cmd+Shift+P, followed by Restart Omnisharp) as it often lost track of my source code and failed to show IntelliSense and errors. Other times, squigglies appeared under most of the code, even though
dotnet build could run successfully. The .NET Test Explorer extension worked well enough, though it sometimes felt a bit sluggish and had some UI display issues. The conclusion here is that extensions are never going to be able to replace the cohesiveness and sturdyness of the built-in tools of Visual Studio 2017.
One of the major improvements Microsoft made with .NET Core is to have a kickass command line interface. For developing on anything but VS2017, that CLI is mandatory. The CLI works well, but I found myself often forgetting to do things that are done automatically in Studio, like adding a new project to the solution file. I’ll chalk that one up to being an old foggy who’s used to the UI-ness of Visual Studio.
My last and largest issue had more to do with macOS than VSCode (or VSMac for that matter). The project I’ve been working on reads configuration (such as API keys and URLs) from environment variables to avoid storing them in source code. A perfectly reasonable approach that macOS does not like one bit. There are a half dozen StackOverflow questions on the subject but most of them are out of date and don’t work with the latest High Sierra update. The solution that worked for me is to run the following commands at a terminal every time I need to set the variables:
launchctl setenv ENV_VAR_NAME "environment-variable-value"
Visual Studio For Mac is a poor man’s VS2017
There’s been some debate whether Visual Studio for Mac is really Visual Studio or a rebrand of Xamarin Studio. My experience with it felt more like the latter, although it is starting to move closer to the former, especially in terms of product development options on the ASP.NET Core side of things.
That’s where the parallels end though. The UI feels Mac-ish but the layout and available views differ drastically from their PC counterparts, making for a jarring transition for someone who’s intimitally familiar with Visual Studio. I struggled with the equivalents of Test Explorer (Test Results and Unit Tests), having to use both in tandem to achieve my testing goals.
The version control windows are also a pale comparison to Team Explorer in VS2017. Both let you view pending changes and manage branches but Team Explorer does it in a much more intuitive way. The version control experience in VSMac reminds me much more of JetBrains’ IDEs than that of Visual Studio 2017.
Why Use Anything But The Flagship IDE?
I appreciate the strides Microsoft is making to enable .NET development on Linux (and therefore macOS). It’s absolutely necessary to do so to continue to grow adoption and interest in the language and it’s definitely off to the right start. But the truth is that it doesn’t come close to the tooling available in VS2017. And how could it anyway? Microsoft have been working on Visual Studio as a product on Windows for the past 15 years. You can’t rebuild that overnight into another product, especially when one of those products isn’t meant to be a one for one replacement (VSCode).
Visual Studio 2017 makes developing for the cloud a cinch. The tooling is second to none, across all development languages. You’d be silly not to use it, even on a Mac where Parallels make it easy to run Windows 10. I’m looking forward to seeing how VSMac will continue to evolve and be brought more into alignment with VS2017. But for now at least, I’ll be sticking with Visual Studio 2017 on Windows.
What If You’re Just Getting Started with .NET?
Visual Studio 2017 is still the best place to start. A person just starting out will be able to get going much quicker in VS2017’s interactive ecosystem. There is a benefit to understanding the command line though, so once you’ve grasped the basics of building applications in .NET, try out VSCode (on Mac or Windows, it makes little difference).
Bottom line: get your hands on .NET Core any way you can, but Visual Studio 2017 is still the way to go.