December 2017

Volume 32 Number 12

[Visual Studio]

Customizing Visual Studio for Mac

By Alessandro Del | December 2017

Visual Studio for Mac is a fully featured native development environment designed for building cross-platform applications with Xamarin and .NET Core on macOS. The IDE enables productivity through a rich set of features and tools, combined with powerful customizations that allow developers to implement their preferences. In my previous article (msdn.com/magazine/mt845621), I discussed Visual Studio for Mac productivity from the point of view of the code editor and debugging tools. In this article, I’ll focus on the customization points that Visual Studio for Mac offers, and the impact those points have on productivity. Most of the customizations described in this article can be done in the Preferences dialog, which you open by selecting the Visual Studio Preferences menu.

Applying Languages and Themes

Visual Studio for Mac quickly allows you to change the display language for the UI. You can do this in the Visual Style tab of the Preferences dialog, selecting one of the available languages from the User Interface Language combo box. Currently, Visual Studio for Mac supports the following languages: Chinese (China and Taiwan), Czech, French, German, Italian, Japanese, Korean, Polish, Portuguese (Brazil), Russian, Spanish, Turkish and, of course, English.

In the same tab, you can change the appearance of the Visual Studio for Mac UI with different themes. At the time of this writing, Visual Studio for Mac offers two themes: Light and Dark. You can apply a theme by selecting the Visual Style tab in the Preferences dialog, and then select a theme from the User Interface Theme dropdown.

When you select a different theme, you’ll be invited to restart Visual Studio. At restart, you’ll see how the theme affects not only the code editor, but the entire workspace, including the pads and dialogs. Figure 1 shows an example based on the Dark theme.

Visual Studio for Mac with Dark Theme
Figure 1 Visual Studio for Mac with Dark Theme

You can actually change the theme for the code editor only, rather than for the complete workspace. This can be useful to keep the editor window highlighted. The Color Theme tab in the Preferences dialog allows you to select from a long list of built-in themes, as well as any themes you create and import on your own. Visual Studio for Mac supports the Visual Studio (.vssettings), Xamarin Studio (.json) and TextMate (.tmTheme) formats, so you can quickly import new themes by simply pressing the Add button and specifying one or more supported themes.

Customizing Keyboard Shortcuts

Visual Studio for Mac offers a huge number of predefined keyboard shortcuts, referred to as key bindings, that make quick work of invoking common commands by reducing time spent mousing around the interface. Key bindings are completely customizable, and you can change them in the Key Bindings tab of the preferences dialog. As you can see in Figure 2, key bindings are grouped by menu. You can change a key binding by clicking a command and then entering the new binding in the Edit Binding textbox.

Customizing Key Bindings
Figure 2 Customizing Key Bindings

Visual Studio for Mac provides a number of built-in schemes with key bindings that recall the same shortcuts used in other popular development tools, such as Visual Studio Code and Xcode. For example, if you’ve been building apps with Xcode for a while, you can select the Xcode scheme and use the same keyboard shortcuts in Xcode for the code editor and debugging in Visual Studio for Mac. As another example, if you’ve been working with Visual Studio on Windows and now you need to work with Visual Studio for Mac, you can select the Visual Studio (Windows) scheme to make use of its familiar keyboard shortcuts.

Customizing Fonts

Visual Studio for Mac gives you control over the fonts used in the code editor, the Output pad, and all other pads (pads are tool windows that can be rearranged and docked in the workspace). Just click the Fonts tab in the Preferences dialog box to access this functionality.

To make a font change, select the font you want to replace, then click the new font (with style and size) in the Select Font dialog. A preview window lets you see what the new font selection will look like. Note that you can replace a default font with the newly selected font via the Set To Default button.

Adding Custom Commands

A common need for developers is to be able to launch external tools from within the development environment against one or more files in the solution. For example, you might want to launch a professional image-editing tool on a bitmap you have in a project, or you might want to launch a particular code editor or command line against a file in a project. Visual Studio for Mac allows you to launch external tools by adding new custom commands to the Tools menu.

To accomplish this, open the External Tools tab in the Preferences dialog and then click Add. In the screen that appears, provide the details for the external tool, such as the text you want to be displayed in the Tools menu (Title field), the tool to be launched (Command field), command arguments such as file or folder names (Arguments field), the directory where the command must be executed (Working directory field) and a keyboard shortcut (Key Binding field). Figure 3 shows an example that launches Visual Studio Code.

Adding a Command to Invoke an External Tool
Figure 3 Adding a Command to Invoke an External Tool

Notice that, for the Arguments and Working directory fields, the target pathname must be supplied via one of the supported constants, such as ${FilePath} that represents the pathname of the current file. However, it isn’t necessary to remember all the possible constants and their meaning. In fact, you can click the arrow-down button at the right of both fields to select a target, and Visual Studio for Mac will show a human-readable description for each target, then will place the corresponding constant into the field when you select the desired target.

With regard to Figure 3, you’ll see File Path in the list of possible targets (which represents the current file). When you select this option, Visual Studio for Mac will add the ${FilePath} constant into the Arguments field. You can also select multiple targets in one field.

Finally, it’s worth mentioning the checkboxes at the bottom of the dialog. If selected, Prompt for arguments will cause Visual Studio to ask you to enter additional arguments that will be passed to the external tool. When the Save current file checkbox is selected, the target file will be saved before the external tool is launched. By checking the Use output window checkbox, the output of the external tool will be redirected to the Output pad in Visual Studio, which is extremely convenient so that you won’t need to shift your focus outside of the IDE. After you click OK, you’ll see a new command in the Tools menu, the text of which exactly matches the string you entered in the Title field.

Working with Custom Layouts

You can arrange the layout of Visual Studio for Mac by displaying or hiding some pads, and by moving and docking pads to a different position in the workspace. The IDE ships with four built-in, general-purpose layouts called Code, Design, Debug and Test, all available in the View menu, and each quickly allowing you to switch to a different pad layout depending on the context. For example, when you start debugging an application, Visual Studio for Mac automatically switches to the Debug layout and then goes back to the previous layout, usually Code or Design, once you’re finished. However, it is common to rearrange the IDE layout based on the developer’s preferences or on the type of the solution with which the developer is working. For example, when working with Xamarin solutions, you might need specific pads that you don’t use with ASP.NET Core solutions and vice versa, or you might want to organize pads in a way that’s similar to Visual Studio on Windows.

Instead of manually rearranging pads every time, Visual Studio for Mac lets you save your own layouts with the Save Current Layout command in the View menu. This command asks you to enter the name of the new layout, then stores your current layout and adds its name in the View menu, below the names of the built-in layouts. This way you can quickly switch to your favorite layout with a single click. Once you select a custom layout, the View menu also enables the Delete Current Layout command for removing custom layout from the list. As you might expect, this command is disabled for built-in layouts.

Extending Visual Studio

Visual Studio for Mac is an environment built upon modules that expose a number of extensibility points. This means that other modules can be installed and that the IDE can be extended with third-party packages, referred to as extensions. This allows you to add new productivity features and tools to Visual Studio. You install, update and manage extensions in the Extension Manager dialog, which you enable with the Extensions command in the Visual Studio menu. In the Installed tab (see Figure 4), you can see the list of installed extensions grouped by category.

Displaying the List of Installed Extensions
Figure 4 Displaying the List of Installed Extensions

You can select an extension and see detailed information in the window to the right. You also have the option to disable or uninstall an extension.

Some built-in, integrated tools in Visual Studio for Mac are extensions themselves. For these extensions, the Uninstall button is generally unavailable and the Disable button is only available if disabling the extension doesn’t affect the core features of the IDE. Extensions that are part of the core of Visual Studio for Mac, such as the ChangeLog Add-in in Figure 4, are presented in gray in the Extension Manager.

If you switch to the Gallery tab, you’ll see a list of available extensions from an online gallery, as shown in Figure 5. In the Repository combo box you can choose to see only stable extensions, only beta release extensions or all extensions.

Discovering and Installing Extensions from the Online Gallery
Figure 5 Discovering and Installing Extensions from the Online Gallery

When you’ve found an extension of interest, click its name on the left, review the details on the right and then click Install. Visual Studio will ask for confirmation and then install the selected extension. Depending on the extension, you’ll find the IDE updated with new project templates, new menu commands, new pads or new context commands. The description you get in the Extension Manager tool should clarify how you access the new tools.

It’s worth mentioning that you can also develop your own extensions for Visual Studio for Mac using an extension called Add-in Maker, which you can find under the Extension Development group of the Gallery tab in the Extension Manager. This package will install all the tools you need to build extensions, including specific project templates that appear in the Miscellaneous node of the New Project dialog.

Add-in Maker is an open source project (bit.ly/2zKxWIa) that’s already emerged as the tool of choice for building extensions for IDEs such as Xamarin Studio and MonoDevelop. The official Microsoft documentation provides an interesting page that explains the extensibility points in Visual Studio for Mac (bit.ly/2yIpvNn) and a walk-through that provides an example based on a simplified extension that makes it possible to insert the current date in the active editor through a command added to the Edit menu (bit.ly/2yJ1V4E). If you plan to build extensions for Visual Studio for Mac with Add-in Maker, I strongly recommend you read these documents before you get started.

Wrapping Up

Productivity often depends on how comfortable the developer feels with an IDE. Visual Studio for Mac puts productivity at its core, enabling developers to customize the most important areas of the workspace. As a developer, you can localize the UI by selecting from a list of available cultures. You can change the visual theme to get the colors you like most, and you can customize fonts according to your preferences. You can also rearrange the pads layout and save each layout for later use, so that you won’t need to manually rearrange pads every time.

Of course, Visual Studio for Mac can be enhanced with custom commands to invoke external tools, which is a very common need. And it can be extended with third-party packages that make it easier to add new features and tools. Combined, these capabilities enable developers to feel more comfortable with the IDE and to customize it in a way to maximize productivity.


Alessandro Del Sole has been a Microsoft MVP since 2008. Awarded MVP of the Year five times, he has authored many books, eBooks, instructional videos and articles about .NET development with Visual Studio. Del Sole works as a senior .NET Developer, focusing on .NET and mobile app development, training and consulting. He has recently authored an upcoming book called “Beginning Visual Studio for Mac” (bit.ly/2hsRxYx). You can follow him on Twitter: @progalex.

Thanks to the following Microsoft technical expert for reviewing this article: Jordan Matthiesen


Discuss this article in the MSDN Magazine forum