Site icon Tomato Soup

Installing Virtual Machines to use Visual Studio on Mac

There are many options for IDEs for developers who are working on a Mac; however, there may still be use cases and instances where the available options are insufficient. For example some projects and client requirements may dictate the use of Microsoft’s Visual Studio (VS)—which is predominantly designed for the Windows OS.

As a workaround for, what most Mac users have done (and is one of Microsoft’s recommendations) is to install a Virtual Machine on ARM Macs to emulate a Windows environment and use Visual Studio from there.

This guide will walk you through the entire process of installing and using Visual Studio on a Mac, with a special mention of a handy productivity plugin you can add to make its performance closer to a natively-installed app.

The Different Visual Studios on Mac

Before you dive right in, here’s something to consider before you install: there are similarly named versions of Visual Studio—and you need to know which one you are looking for.

The first one is the native app “Visual Studio 2022 for Mac” (VS 2022 Mac). The naming scheme is how Visual Studio Code is to Visual Studio—they’re two completely different products that confusingly share a similar name.

The native Visual Studio for Mac is largely based on Xamarin, another cross-platform framework for building native mobile apps on iOS, Android, and Windows. It is primarily used for C# or .NET development. Consequently, Visual Studio for Mac is also used primarily for C# development. 

VS 2022 Mac has been discontinued in favor of “Visual Studio Code” (VSC) for Mac. You can use Microsoft’s VSC with the new C# Dev Kit and related extensions in lieu of VS 2022 Mac. The caveat is that VSC may not be enough for C++ developers, or for C# developers who rely on VS’s frameworks and libraries for their app or program development needs.

Fortunately, if you’re opting for VSC on Mac, it may be good to know that there is less discrepancy between the Windows and Mac versions of VSC—just a few keystroke and shortcut differences. 

To summarize, here are the Visual Studios that you can use on Mac:

Of course users can also opt to use alternative IDEs. In this blog, however, we will be teaching you how to install the second option—a virtual machine on your Apple-silicon Mac and installing Visual Studio, the complete Windows version, (VS for Windows on a VM) thereafter.

 

Why you may need Visual Studio for Windows on Mac

The primary reasons to use Visual Studio for Windows on a Mac are the following:

Other considerations may be based on developer preferences such as those who like Visual Studio for tasks like debugging complex applications, managing large solutions, or using specialized extensions that are only available on the Windows version.

For game developers using Unity, Xamarin developers building cross-platform mobile apps, or .NET developers focusing on backend and cloud development, using a VM allows you to retain access to the full suite of Visual Studio’s tools. This includes robust debugging features, integrated version control with Git, and comprehensive support for a variety of programming languages and frameworks.

Prerequisites for Installation

Visual Studio 2022 has official requirements which you can read here. However, we can summarize for some advice:

If you’ve never used a virtual machine for development before, you might be worried about performance – after all, it’s not running directly on the hardware, right? In practice, this is not an issue. Modern CPUs have inbuilt support for running virtual machines and your VM is not emulated; it runs code directly on the CPU just like the host operating system does.

The biggest mistake people make is not giving a VM enough RAM or dedicated CPU cores. Run on a powerful machine and configure the VM to a couple of cores minimum, and at least 4GB of RAM minimum. If you do heavy computation on the VM (building large projects, etc) increase that. Make sure you have a host machine powerful enough that if you allocate, say, half its resources to the VM then both have enough resources to run. A Macbook Air has 8 cores, so you can allocate 2 to 4 to the VM; if you have 16GB of RAM, you can allocate 4GB to the VM and leave macOS 12GB. This kind of setup works well.

Before diving into the installation process, ensure your Mac meets the following requirements. To summarize, however, any recent computer will meet them in terms of performance—the more important components to consider are available RAM and disk space

Hardware Recommendations:

By following the recommended setup, you’ll meet or exceed the necessary hardware requirements, making your development experience seamless even within a virtualized environment.

Step-by-Step Installation Guide

In this guide, we’ll walk you through installing Visual Studio on your Mac using a virtual machine. Since Visual Studio is no longer natively supported on macOS, setting up a virtual machine (VM) is the best approach to ensure you have access to the full range of Visual Studio features. Below, we’ll outline the steps using Parallels Desktop, a popular VM software for Mac.

Step 1: Choosing Your Virtual Machine Software

Before installing Visual Studio, you need to set up a virtual machine that runs Windows on your Mac. Here are some of the top options currently available:

For this guide, we’ll focus on Parallels Desktop. This is the officially supported way Microsoft offers to run Windows on a modern ARM Mac.

Step 2: Installing Parallels Desktop

  1. Download Parallels Desktop:
    • Visit the Parallels Desktop website.
    • Click on the “Try Now” or “Buy Now” button, depending on whether you want a trial or full version.
    • The installer file will start downloading.
  2. Install Parallels Desktop:
    • Open the downloaded .dmg file.
    • Drag the Parallels Desktop icon to the Applications folder.
    • Open the Applications folder and double-click the Parallels Desktop icon to launch it.
    • Follow the on-screen instructions to complete the installation. You may need to grant permissions and sign in with a Parallels account.
  3. Set Up a New Windows Virtual Machine.
    • When you first launch Parallels Desktop, it will prompt you to set up a new VM.
    • Choose to install Windows from an ISO image file or from an existing Windows installation disk
    • Parallels may also offer the option to download and install Windows directly, streamlining the process

    • Follow the prompts to complete the Windows installation. This process may take some time as Windows sets up.

If you’ve done everything correctly, you will get to this confirmation screen.

Step 3: Downloading Visual Studio for Windows

Now that you have Windows running on your Mac via Parallels, you can proceed with installing Visual Studio.

  1. Download Visual Studio:
    • Within your Windows VM, open a web browser and visit the Visual Studio download page.
    • Choose the edition of Visual Studio you want to install (Community, Professional, or Enterprise).
    • Click the “Download” button to start downloading the installer.

      Note: This is open on a browser window inside the VM.

       

  2. Install Visual Studio:
    • Once the download is complete, open the installer file.
    • Follow the on-screen instructions to select your workload preferences (e.g., C++ desktop development, .NET desktop development, ASP.NET and web development, game development with Unity).
    • Click “Install” to begin the installation. This process may take some time, depending on the selected workloads and your internet speed.
    • After installation, launch Visual Studio from the Start menu within your Windows VM.


Step 4: Setting Up Your First Project

  1. Once Visual Studio is installed, open it and select “New Project.”
  2. Choose the type of project you want to create (e.g., Console App, Web App, Mobile App).
  3. Follow the prompts to configure your project, including setting the project name and location.
  4. Click “Create” to generate your new project.

Using Visual Studio for Windows on Mac: Navigating the Interface and optimizing the Virtual Machine

When running Visual Studio on a virtual machine (VM) on your Mac, there are some key differences and considerations to keep in mind to ensure a smooth development experience:

Keyboard Shortcuts

Running Visual Studio in a VM can result in some keyboard shortcuts behaving differently than they would on a native Windows PC. This is due to differences in how macOS and Windows handle certain key combinations. Here are a few tips:

Display and Resolution

When running a VM, Parallels offers different display modes to suit your workflow:

Parallels generally sets up Windows with the correct DPI settings automatically, so display resolution issues are rare. Adjusting these settings usually requires deliberate changes, making it easy to maintain a crisp and consistent interface across your VM and macOS.

Enhancing the Experience with Visual Assist

Developing on a VM can present unique challenges, but with the right setup and a few tweaks, you can create a development environment that’s nearly as effective as working on a native Windows machine. By paying attention to how keyboard shortcuts behave, optimizing performance settings, and ensuring good network connectivity, you can make the most out of Visual Studio in a virtualized environment on your Mac.

Visual Assist, renowned for its powerful productivity features, is now fully supported on ARM devices, including Macs with Apple Silicon (M1, M2, etc). Here’s how to install it:

  1. Initiate the Virtual Machine environment. Launch whatever VM you installed.
  2. Open Visual Studio on your Mac: Launch the Visual Studio application to begin the installation process.
  3. Navigate to Extensions > Manage Extensions: In the top menu, click on “Extensions,” then select “Manage Extensions” from the dropdown. This will open the Extensions Manager window.
  4. Search for “Visual Assist” and click “Install”: In the Extensions Manager, use the search bar to find “Visual Assist.” Once located, click the “Install” button next to the extension. You can also download it straight from the VS marketplace. The installation process will begin automatically.

  5. Restart Visual Studio to enable the extension: After installation, restart Visual Studio to activate Visual Assist. Once restarted, you will have access to all the powerful features Visual Assist offers.

Benefits of Visual Assist on ARM Devices

With Visual Assist enabled on ARM devices, Mac users can experience a significant boost in productivity and code quality. Here are some of the key benefits:

By leveraging the capabilities of Visual Assist on ARM devices, you can significantly enhance your coding experience on Mac. Whether you’re working on small projects or large-scale applications, Visual Assist provides the tools and features you need to be more productive and write better code.

Conclusion

Congratulations! You have successfully installed Visual Studio on a virtual machine. You should now be able to develop as you would normally on a native Windows device. Tech is always changing and we can assume that with advances in both hardware and software, we will be able to utilize more performance with less in the future—but for now, enjoy your new virtual machine, fit with a fresh install of Visual Studio! Happy coding.

Exit mobile version