Mac For Visual Studio

Installation

Mobile Development. Visual Studio for Mac has a heritage in Xamarin Studio, and thus supports cross-platform application development for iOS, Android, and macOS with Xamarin. By installing the iOS and Android SDKs, you can build cross-platform mobile apps using C#, with complete access to the underlying native APIs (including tvOS and watchOS). And in the course Visual Studio Development on a Mac, you'll witness the impact a virtual machine running Windows and Visual Studio has on its host, the Mac OS X. This smooth performance is in the details of Apple's hardware and the cleverness of the virtual machine software.

Persistent performance and reliability issues in the Visual Studio for Mac IDE will be addressed by replacing most of the editor internals with code from the Visual Studio Code editor. That news comes in a blog post today (Oct. 16) announcing Visual Studio for Mac 2019 and a new roadmap.

  1. Download Visual Studio Code for macOS.
  2. Double-click on the downloaded archive to expand the contents.
  3. Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
  4. Add VS Code to your Dock by right-clicking on the icon to bring up the context menu and choosing Options, Keep in Dock.

Launching from the command line

Visual Studio Code

You can also run VS Code from the terminal by typing 'code' after adding it to the path:

  • Launch VS Code.
  • Open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
  • Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.

Note: If you still have the old code alias in your .bash_profile (or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install 'code' command in PATH command.

Mac For Visual Studio

To manually add VS Code to your path, you can run the following commands:

Start a new terminal to pick up your .bash_profile changes.

Note: The leading slash is required to prevent $PATH from expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.

Touch Bar support

Out of the box VS Code adds actions to navigate in editor history as well as the full Debug tool bar to control the debugger on your Touch Bar:

Mojave privacy protections

After upgrading to macOS Mojave version, you may see dialogs saying 'Visual Studio Code would like to access your {calendar/contacts/photos}.' This is due to the new privacy protections in Mojave and is not specific to VS Code. The same dialogs may be displayed when running other applications as well. The dialog is shown once for each type of personal data and it is fine to choose Don't Allow since VS Code does not need access to those folders. You can read a more detailed explanation in this blog post.

Updates

VS Code ships monthly releases and supports auto-update when a new release is available. If you're prompted by VS Code, accept the newest update and it will get installed (you won't need to do anything else to get the latest bits).

Note: You can disable auto-update if you prefer to update VS Code on your own schedule.

Preferences menu

You can configure VS Code through settings, color themes, and custom keybindings and you will often see mention of the File > Preferences menu group. On a macOS, the Preferences menu group is under Code, not File.

Next steps

Once you have installed VS Code, these topics will help you learn more about VS Code:

  • Additional Components - Learn how to install Git, Node.js, TypeScript, and tools like Yeoman.
  • User Interface - A quick orientation around VS Code.
  • User/Workspace Settings - Learn how to configure VS Code to your preferences settings.

Common questions

Why do I see 'Visual Studio Code would like access to your calendar.'

If you are running macOS Mojave version, you may see dialogs saying 'Visual Studio Code would like to access your {calendar/contacts/photos}.' This is due to the new privacy protections in Mojave discussed above. It is fine to choose Don't Allow since VS Code does not need access to those folders.

If you have been working on iOS applications, you probably have pulled your hair out at some point. The signing of the application binary can be a real brain teaser. While there is no way around it, Microsoft is on a mission to automate it as much as possible. Enter Fastlane.

To be able to run your app on a physical device, Apple needs you to sign your binary with certificates and provisioning profiles. Especially the first time, this can be daunting to say the least. In my opinion the process around it is hard and confusing. I know why it needs to be done, I see why it is important, but each time I forget how to do it and it takes me too long to set it up for my new app.

Luckily, Microsoft has seen this burden as well and has decided to do something about this. Since Apple is unlikely to respond to any of the requests of Microsoft, we can’t get around to how Apple has arranged all of this. But what can be done is automate as much as possible in a way that we, as developers, do not have to be bothered with any of this anymore.

Microsoft has incorporated this now into Visual Studio for Mac and in this post I will show you how to set it up. Before we go and see there is one thing I need to note. I will assume that the Apple Developer account you’re using is your own, or at least that you will have the Agent role, which gives you all the necessary rights to generate certificates and provisioning profiles. If you are working for a company or are part of a team, check to see if you have the required permissions. If not, this will not work.

Visual Studio Download

At the time of writing, this isn’t available in Visual Studio for Windows or automatic build pipelines, but I’m confident this will follow soon.

Mac Visual Studio Unity

A tool that has been around for some while now is Fastlane, find more info on it on their website. Fastlane actually consists of multiple solutions, but one of them is code signing and that is what we will focus on here. Besides code signing, you can also use it to generate app screenshots, distribute beta versions and also deploy to the actual app stores. Since the tools are open-sourced on Github, you can actually see what is going on or maybe even contribute. First let’s have a look at how to set things up on your Mac.

Visual Studio for Mac

The first thing we need to do is install Fastlane on our machine. A prerequisite is to have Xcode installed, but since we’re all Xamarin developers here, I will assume you already did. There is two ways to install Fastlane. One is through Homebrew, the other one is to download the tools through the Fastlane website. I will show you the latter. If you know what Homebrew is and have set it up on your machine, simply run brew cask install fastlane.

Install the tooling

Go to https://download.fastlane.tools/ and a zip with the tools will start downloading immediately. Unpack it and run the install file. You will probably get a warning from Mac OS that you can’t run this code. Go to your Mac OS system preferences, then Privacy & Security and click the Open Anyway button to run the install file. After you did, a Terminal window will pop up and start installing as seen in the screenshot below.

After copying a bunch of files, the installer will ask: Do you want fastlane to add itself to the PATH by updating your profile? (y/n). Affirm with Y.

Watch closely what happens next. Depending on your user account, you might see something like access denied. In either case, run the which fastlane command. The output should look like /Users/[user]/.fastlane/bin. If there is no output, run export PATH=”$HOME/.fastlane/bin:$PATH” and check the which command again.

Configuring Visual Studio

Next up is to configure Fastlane in Visual Studio for Mac. Start Visual Studio, and open the preferences. Under the Publishing node, find the Apple Developer Accounts. Here is where you add your Apple account(s).

Visual studio for mac free

In the middle column, find the plus (+) button near the bottom of this screen. Through this button, you can add your Apple developer account to Visual Studio, and ultimately Fastlane. Enter your credentials and hit the Sign In button to add your account. The account details should pop up on the right side, after it was successfully added. Check that you have enough right. If it is your private account, you should be listed as Agent. If not, you will receive errors stating that your account does not have enough rights to generate certificates.

C++ Redistributable For Visual Studio 2015

Configure projects

Now, for every iOS project, you can go into the info.plist file, and select the right team for this particular app. You can then tick the box to provision the app automatically and from there, you’re life should be a lot easier.

Please note that, when enabling this option, for all build configurations the CodesignProvision and CodesignKey nodes will be changed/added in the iOS csproj file.

Visual Studio For Mac Wikipedia

With this in place, there is one less thing you need to worry about when building your apps. This means there is more time to focus on implementing actual, awesome features! As mentioned; this is only available in Visual Studio for Mac at this time, but I’m sure the smart people at Microsoft will bring this to Windows in the near future.