Visual Studio for Mac is something that many Microsoft developers have sought for more than a decade. As Mac OS X became interesting in the early 2000s, coders who spent most of their days working in Visual Studio on Windows wondered why they couldn’t use the same languages, frameworks, and tools for the Mac, rather than needing to learn Objective-C, Cocoa, and Xcode, all of which were substantially different from the languages and tools for Windows development.

Many of us thought the ECMA standards for C# and the .Net Framework, and the Mono project spearheaded by Miguel de Icaza (first at Ximian, then Novell, then Xamarin, and finally at Microsoft), might provide a path to a unified development platform. I for one had no idea it would take so long, although I was aware of at least some of the rather Byzantine politics going on among the various interested parties, through my involvement with the .Net series of books. I was also aware of the reputation that both Mono and Xamarin had for being “a bit crashy.”

[ Discover the career hacks for becoming the developer everyone wants in InfoWorld’s Deep Dive. | Keep up with hot topics in programming with InfoWorld’s Application Development newsletter. ]

The introduction of the lightweight, portable Visual Studio Code, and the gradual integration of Xamarin tools into Visual Studio 2015, were positive signs in my view. Once Microsoft announced it would acquire Xamarin (in February 2016) it became clear to me that the Xamarin Studio and Visual Studio IDEs were likely to merge on the Mac to create a single development environment, but I wasn’t sure exactly what form it would take or how many of the features from Visual Studio for Windows could or would be implemented on the Mac.

Inside Visual Studio for the Mac

Essentially, Visual Studio for the Mac is Xamarin Studio plus a Visual Studio look and feel, along with Roslyn-based C# IntelliSense, refactoring, analyzers, and code fixes; NuGet-based package management; a Visual Studio-compatible project format; the MSBuild engine; integrated unit testing; and support for F#.

Let’s unwrap that a little to understand what it means, in case you aren’t familiar with both Xamarin Studio and Visual Studio. In general terms Visual Studio for Mac is an integrated Macintosh development environment for C# and F# applications that run on iOS, Android, and Mac targets, with a variety of application forms and technologies, including game engines. Several of the app types use portable frameworks. Some support iOS and Android with Xamarin, and others support iOS and Mac games with SpriteKit (2D) and SceneKit (3D).

You’ll find intelligent editing everywhere you work with C# files, including autocompletion as shown in the figure below. When you hover over a variable or method name you’ll see an informational pop-up about it. When you right-click or control-click on code, you’ll see a context menu offering whatever actions are appropriate, such as code fixes, navigation to declarations and references, and refactoring.

NuGet is the package manager for Visual Studio; it downloads and updates references on demand. As long as you and the NuGet server have good connectivity, it works well. The point of using a compatible project format and the same MSBuild engine is that a team doesn’t need to standardize on a single development platform. Team members working from Macs and Windows PCs can collaborate on a single iOS and/or Android project.

IntelliSense works for C# files no matter what platform you are targeting. The Roslyn compilers underpin this and other intelligent-editing features.

Diving into Visual Studio for Mac

True to form, the relatively small online installer for Visual Studio for Mac in turn downloads and installs a huge bag of stuff from various places, including the whole Android SDK. On my iMac, it downloaded nine items, totaling almost 4GB.

Of course, given that I was trying the installation within a day of the product announcement, the download failed multiple times, at various points, and took hours. I guess some things never change.

On the third or fourth try it mostly succeeded, except for the Xamarin Profiler. As this is Preview 1, I’ll give Microsoft/Xamarin a pass on the Profiler installation.

Visual Studio for Mac has a layout and menu structure that should be familiar to Visual Studio developers, along with the multiplatform features of Xamarin Forms and targets for iOS, tvOS, Android, MacOS, .Net Core, and ASP.Net. Forms apps can be in C# or F# and include a shared or portable class library project. Connected Xamarin Forms apps are in C# and include a .Net Core mobile services app.

When I attempted to create a new Xamarin.Forms App project for iOS and Android, I felt like I was in familiar territory, based on my experience with Windows versions of Visual Studio, and on having worked through Charles Petzold’s book on Xamarin.Forms development. The new project wizard offered straightforward choices, the code generation seemed like it was going OK, and the NuGet packages were resolving, but then blooey. While the iOS project was OK, the Android project failed during the NuGet stage.

Here we see the new project wizard to configure a Forms App. Portable Class Libraries are for sharing code with other developers; Shared Libraries are for sharing code within a solution.

Although the solution pane on the right looks familiar and the Getting Started page looks like a helpful outline, the Android NuGet dependencies failed during the project creation. I had just installed the product and hadn’t had time to screw anything up myself, so let’s call this a Preview bug. Fortunately, it went away later.

I tried that again with the same result. A few hours later when Microsoft asked for an error trace, I tried it a third time—and it worked fine. I don’t really know why it failed, then worked, but my guess is that there was a problem (bandwidth? heavy usage? DoS attack?) at the NuGet repository that was then fixed.

In any case, I was finally able to run the generated app for both iOS and Android.

Here we see Visual Studio for Mac running a “hello, world” Xamarin.Forms app with an iPhone emulator.

Visual Studio for Mac running the same “hello, world” Xamarin.Forms app with an Android emulator.

You know what else was familiar besides the layout? The startup time. It felt like starting Visual Studio 2010 on an Athlon box. I had time to boil water and brew tea. I hope that the startup time will be optimized, but I don’t have high expectations. Long startup times were an issue in Visual Studio on Windows for many years, and it took a lot of work to solve.

Similarly, both the iOS and Android emulators took more than a few minutes to start up. That isn’t Microsoft’s fault, however: I see the same long startup time for emulators in Xcode and Android Studio. It’s a good argument for either keeping the emulators running (at the cost of hogging memory) or using physical mobile devices for testing and debugging.

Targets, languages, and project types

In addition to Xamarin.Forms apps in the multiplatform category, Visual Studio for Mac targets single-view Xamarin C# apps with native controls for Android and iOS, with and without a mobile services connection. It also targets C# Apple SpriteKit (2D games) and Apple SceneKit (3D games) for iOS and MacOS.

For iOS, Visual Studio for Mac offers nine different kinds of project. Only the single-view app currently offers F# as a language option; all the rest offer only C#.

For iOS only, Visual Studio for Mac targets five general app types and four game frameworks. In addition to SpriteKit and SceneKit for games, it supports the Metal engine (Apple’s two-year-old answer to Microsoft DirectX) and OpenGL (the 24-year-old portable, free, open source, hardware-accelerated Open Graphics Library). All of the iOS options support C#; the single-view app target also supports F#. The TvOS targets are, not surprising, a subset of the iOS targets.

For Android, Visual Studio for Mac offers four general app types, including a Wear app and three types of OpenGL game app. OpenGL ES is an API subset for embedded systems. ES 3.0 requires Android 4.3 and higher and hardware support for the graphics pipeline.

The Android targets include seven types of app, including Android Wear (watches and so on) and three levels of OpenGL. Only the basic Android app supports F#; the other six are strictly C#.

For the Mac, Visual Studio for Mac supports Cocoa apps with a storyboard and SpriteKit, SceneKit, and Metal games. Cocoa apps can optionally support the document architecture and can target MacOS versions going back to Lion. And it supports .Net Core apps for console or web and .Net apps for console or Gtk#. ASP.Net apps can use MVC or Web Forms.

Visual Studio for Mac relies on Xcode for editing MacOS and iOS storyboards. Changes made in Xcode flow back to Visual Studio if you launch Xcode from Visual Studio. Otherwise, you can use the “Sync with Xcode” action in Visual Studio.

Wisely, Visual Studio for Mac delegates tasks that Xcode already does well to Xcode proper—for example, Storyboard editing. On the other hand, having the Visual Studio debugging interface is an unexpected pleasure. It’s not that Xcode or Android debugging is bad; it’s more that debugging comprises a large chunk of a developer’s time, and having everything you need be where you expect is a productivity boost.

Debugging with Visual Studio for Mac feels very familiar and similar to Visual Studio on Windows.

For non-Windows only

Is Visual Studio for Mac Preview 1 ready for prime time? Of course not. You knew that when you saw the version designation. I can verify the bugginess and slowness firsthand.

On the other hand, is it likely to be good when it’s done? Yes, as long as Microsoft can fix the pesky performance issues that always accompany large IDEs such as Visual Studio. I’m less worried about the outright bugs. Microsoft has been doing a decent job of stamping them out since switching from annual or (shudder) biannual product drops to monthly updates with more-than-annual service pack rollups.

Remember, though, that Visual Studio for Mac doesn’t have the same scope as Windows versions of Visual Studio. There is no C++ or Basic or Office support, no repositories other than Git, no Azure or database support, no Raspberry Pi support, and no Windows classic or Universal Windows support.

I don’t expect Microsoft to ever provide a Windows emulator for Macs. That can be handled now with virtual machine hosts such as Parallels Desktop and VMware Fusion, and that’s not really the point of Visual Studio for Mac. No, Visual Studio for Mac is primarily a way to develop for iOS devices from Visual Studio in C# and F# without needing both a Windows computer and a Mac, and secondarily to develop for the Mac in C# and F#. Adding Android development to the mix is nice to have, not necessary.

I would hope that some of the missing scope will be added over time, in particular integration with Azure (currently a command-line or web-based task on the Mac), but I see expanding the scope of Visual Studio for Mac as a long-term project that’s secondary to the short-term project: evolving the current preview into a release version that’s relatively bug-free and doesn’t feel slow for a developer’s repetitive tasks.

I’m not worrying about the time it takes to do a full rebuild of a large project. That can be addressed with build servers and nightly local builds, as we do now on Windows boxes. Nor am I worrying about the time it takes to generate a new solution or project. That can always be done before heading to a meeting, the gym, or a meal. No, I want basic development tasks—editing, incrementally building, testing, debugging, and profiling—to happen in a way that doesn’t interfere with a developer’s flow.

Visual Studio for Mac has been a long time coming. I expect it will be worth the wait.

—-

Cost: Free preview. Platform: MacOS 10.11 or greater; Xamarin development requires Xcode.