Running Visual Studio for Windows on a Mac
As a Mac user who does a lot of Microsoft development, I sometimes need to use the Windows version of Visual Studio.
Yes, I have Visual Studio for Mac installed but it’s not as feature rich as the Windows version. Also, after spending many years working with the Windows version, Visual Studio for Mac seems a bit alien.
I’m a big fan of Visual Studio Code because it’s light-weight and feature rich. But I tend to use it mainly for frontend development. For some projects, I use both at the same time.
By keeping the frontend (in my case React) code nested in a separate folder within the project, I can open it up in Visual Studio Code and treat it like a separate application.
This setup means the frontend application can be worked on, in theory, by a separate frontend team. Importantly, it can have its own build pipeline and environment setup. Breaking apart your ASP.NET application like this is good practice.
Running Visual Studio for Windows as a Mac user
If you want to run Visual Studio (Windows) on your Mac, you have a few options:
Create a disk partition for Windows using Boot Camp.
Run a local VM using virtualisation software (like Parallels).
Run a remote VM using a cloud platform (like Azure).
There are a few reasons why you might not want to choose options 1 or 2, however.
Maybe you don’t want to sacrifice the disk space it requires to run a local VM. Or maybe you don’t like using Parallels. In my case, I often only need to use Visual Studio (Windows) for a short period and don’t want to pay for a Windows and Parallels licence.
This leaves option 3. If you have a Microsoft Azure account, you can simply spin up a VM that comes with Visual Studio pre-installed. Then just remote desktop into the Virtual Machine whenever you need to do some Windows-based Visual Studio development!
How to get started
If you don’t have an Azure account then you can get one for free.
In the Azure portal, create a new resource and search for “Visual Studio” in the marketplace search tool. This will list all the available images. You’ll need to choose a Windows Server 2016 rather than Windows 10 image if you don’t have an MSDN licence.
Once your VM is up and running, you can RDP into it and install any other software you need. To actually remote into the VM, install the Microsoft Remote Desktop tool on your Mac, which is available in the App Store.
One of the powerful things about using an Azure VM to run Visual Studio is that it’s completely pay-as-you-go. You can simply deallocate the VM whenever you’re not using it.
In fact, as you’re setting up the VM, Azure will ask you if you want to automatically shut down and deallocate your VM at a specified time of day. It’ll helpfully send you a reminder email an hour beforehand each day. You can choose to override the automatic shutdown if you want.
Of course, you can just manually stop and deallocate the VM whenever you’re finished. All your programs and data will be saved in the storage account that got created when you set the VM up.
Potentially, this will be a lot cheaper than paying the licence fees required for running Windows on your Mac using a local Virtual Machine. Especially, if you only need to run VS for Windows occasionally.