Ms Visual Studio For Mac

[Visual Studio]

In May 2017, Microsoft announced the release of Visual Studio for Mac, a full-featured development environment to help developers on the Mac create apps, games, and services for mobile, cloud, and web. Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. At Microsoft our mission and values are to help people and businesses throughout the world realize their full potential. Microsoft says it is planning a host of upgrades and improvements to make Visual Studio 2019 for Mac better and easier to use. It is not a comprehensive list of all new features in Visual Studio for Mac, but is intended to provide some visibility into our key investments. These feature sets and delivery timeframes are current, and are subject to change. Unfortunately, Server Explorer is not (yet) available for the Visual Studio for the Mac. Microsoft has not yet clarified whether Visual Studio for the Mac will always be different than the traditional VS, but so far that is the case.

By Alessandro Del Sole | 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.


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.


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.


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.


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.


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.

Code

Alessandro Del Solehas 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

FAQ

Visual Studio On A Mac

  • Connect to Turing
  • Enhance Windows Performance

System Requirements

  • To install Visual Studio on your Mac you need, minimumally:
    • an Intel Mac
    • 1 GB of Memory
    • 25 GB of free hard drive space
  • You can check the first two by clicking on the Apple icon on the top left and opening up 'About this Mac'.

Downloads

  • Download VirtualBox for yor Mac here
  • This downloads the file VirtualBox-3.2.8-64453-OSX.dmg.
  • Open this file and follow the installation instructions.

Create a Virtual Machine

  • Start VirtualBox
  • Create a new virtual machine by pressing the blue star labeled New




  • Press continue on the dialog box.
    • Name your machine: Win7-CS150
    • Operating System: Microsoft Windows
    • Version: Windows 7
  • Press continue on the dialog box.
  • In the Memory dialog, give your machine 1024 MB of RAM. You can type in the box on the right.
  • Press continue on the dialog box.
  • In the Virtual Hard Disk screen accept the defaults (Boot Hard Disk, Create new hard disk) and press continue.
  • In the Welcome to the Create New Virtual Disk Wizard press continue.
  • Select a Fixed-Size storage in the Hard Disk Storage Type and press continue.
  • Specify a 25 GB hard drive in the Virtual Disk Location andSize dialog. You can type in the box on the right. Press continue.
  • In the Summary dialog, press Done. Wait while it processes.This may take up to 30 minutes, depending on the speed of your machine.
  • Once this finishes, press Done.

Install Windows

  • You should now see Win7-CS150 listed on the left side on the
    VirtualBox Window. Select that virtual machine.
  • Put the Windows 7 Disk in the CD/DVD Drive

  • Click Storage on the right panel.
  • Select the Empty CD/DVD
  • In the right panel, choose Host Drive in the CD/DVD Device drop down box. and press OK.
  • With Win7-CS150 highlighed, press the green Start arrow at the top of
    the window.
  • This should start the Windows 7 Installer. TheInstaller will ask you various questions and take up to 2 hours toinstall Windows.
  • Once Windows completes the installation eject the Windows install disk.
  • While Windows is not running, Click Storage, the CD/DVD Icon, and set the CD/DVD Device to Empty.
  • The DVD may show up on the Mac desktop. If it does, drag it to the Trash to eject the DVD.

Install Visual Studio

  • Put in the Visual Studio Disk
  • While Windows is not running, Click Storage, the CD/DVD Icon, and set the CD/DVD Device to Host Drive.
  • Start Windows again.
  • The Visual Studio DVD should show up in Windows. If not,inside of Windows open My Computer, and click on the CD/DVDDrive. This should start the Visual Studio installer.
  • The install may take up to an hour. Once the installfinishes, eject the DVD as described above and Visual Studio shouldwork.
  • Bring both disks back to the instructor and you'll be given a Windows Key to activate Windows.

Activate Windows

  • Start Windows.
  • Open My Computer
    • Start Menu | Computer
  • Choose System Properties from the menu bar.
  • Click on the Active Windows Now link towards the bottom of the dialog box.
  • Provide the license key given to you by the CS Department. You need to be connected to the network for this to work.

Connect to Turing

  • Open My Computer
    • Start Menu | Computer
  • Choose Map network drive from the menu bar.
  • Choose a drive letter (any letter)
  • Folder: turing.cs.pacificu.eduStudents
  • Check Connect using different credentials
  • Press Finish
  • Supply your PUNetID for your user name and your Turing password.
  • The Turing drive should show up on the bottom of the computer dialog under Network Locations.

Ms Visual Studio For Mac

Update Windows

  • Open My Computer
    • Start Menu | Computer
  • Choose System Properties from the menu bar.
  • Select Windows Update in the lower left corner
  • Select any important or optional updates to install
  • Install Updates

Enhance Windows Performance

  • Open My Computer
    • Start Menu | Computer
  • Choose System Properties from the menu bar.
  • Select Performance Information and Tools in the lower left corner
  • Select Adjust visual effects on the left menu
  • Choose Adjust for best performance
  • Apply
  • Ok

Install Visual Studio For Mac