Microsoft Visual Studio Code For Mac

Hi there, it’s the same faces, but in a new location!

Visual Studio for Mac's integration with Roslyn, Microsoft's open-source.NET compiler platform, allows for more refactoring operations. Renaming The Rename refactoring command can be used on any code identifier (for example, a class name, property name etc.) to find all occurrences of that identifier and change them. The Visual Studio code editor also supports code refactoring including parameter reordering, variable and method renaming, interface extraction. It is possible to run CIL programs in Linux or Mac OS X using non-Microsoft.NET implementations like Mono and DotGNU.

Welcome to moof IT, the new home of my colleagues and I. I’ll be continuing to submit blogs on anything and everything that I feel will help out other Apple Admins as I’ve done previously. Right, enough waffle, lets get to it.

In this blog post, we’ll explain how we went about managing Microsoft Visual Studio Code for Mac.

Microsoft Visual Studio for Mac

Released back in March 2016, Visual Studio is Microsoft’s own offering for Code editing, for Windows, Mac and Linux.

Recently we were asked to package and deploy this piece of software for a UK university. Managing Microsoft Visual Studio Code for Mac turns out to be a bit of a pain. Especially working out how to include a number of custom extensions (once myself or one of my colleagues gets our notes square, we’ll try and share our methods).

One of the extra tasks, as you’d expect in many locations, is the ability to control and manage the release of updates to client devices. As part of this, we were required to suppress the automatic checking for updates, for two key reasons:

  1. It allows us to both control the ‘current’ level of patching for the application, as well as proceed with a phased ‘dev’ -> ‘testing’ -> ‘live’ rollout strategy.
  2. It should reduce the pop up messages disabled to users as they launch the run the application.

After a lot of digging I found the information I required, here.

Oh, it’s a JSON file. In the User’s home area. And in a nested directory within Application Support. That’s gonna rule out using profiles. sigh

It’s Scriptin’ Time

Ok, on another blog I wrote about dumping a web shortcut file (a web-lock file) on the currently logged in user’s desktop. I’ve taken the majority of that script, and turned it into this one.

So what’s it doing eh?

  • Line 23– This is the name of the file we need
  • Line 30 – This is the path to the directory the file sits in
  • Lines 38-47– This checks if the logged in user is either ‘root’ or blank, and bails
  • Lines 52-69 – This will check for the parent directories and create them if required
  • Lines 61-69– This will create the file with the required contents and permission it as expected.

Gotcha’s

Some gotcha’s about this script in it’s current usage:

  1. If a user already has launched Visual Studio, they’d almost certainly already have a populated settings file, and…well…this script will wipe it clean, before applying what we want, so I’d suggest having this script run at login, once per user.
  2. Managing Microsoft Visual Studio Code for Mac requires that you write to a text file. It is possible for the user to undo these changes. If you wish to be able to manage this setting in an Apple supported manner, perhaps with the use of a configuration profile (much like the Office for Mac suite), I’d suggest getting in touch with the developers, perhaps via the Community Pages
  3. If the script detects the root user account, or no user account, it will exit without doing any work. These two scenarios tend to mean the device is sitting at the login window, or some other strangeness that would stop the script completing fine anyway.
  4. I’ve only tested this scripted solution on 10.12.x and 10.13.x.

How do I use the script?

I’d suggest using this as a Jamf Pro (formally Casper Suite) login policy, or using one of the outset ‘login‘ triggers.

Summary

And there we go, I’ve detailed the solution we used for managing Microsoft Visual Studio Code for Mac, specifically to suppress the app’s auto-update checks (and prompts). Hopefully that’ll help some of you out! As always, if you have any questions, queries or comments, let us know below (or @daz_wallace on Mac Admins Slack) and I’ll try to respond to and delve into as many as I can.

The usual disclaimer:

While the author has taken care to provide our readers with accurate information, please use your discretion before acting upon information based on the blog post. I will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.

Active1 year, 6 months ago

I want to install Visual Studio on macOS. Is this possible?

dayanruben

Download Visual Studio Code For Mac

Microsoft visual studio code
5271 gold badge9 silver badges19 bronze badges
Priyank saxenaPriyank saxena
Code

7 Answers

Yes! You can use the new Visual Studio for Mac, which Microsoft launched in November.

Read about it here: https://msdn.microsoft.com/magazine/mt790182

Download a preview version here: https://www.visualstudio.com/vs/visual-studio-mac/

vyedinvyedin

I recently purchased a MacBook Air (mid-2011 model) and was really happy to find that Apple officially supports Windows 7. If you purchase Windows 7 (I got DSP), you can use the Boot Camp assistant in OSX to designate part of your hard drive to Windows. Then you can install and run Windows 7 natively as if it were as Windows notebook.

I use Visual Studio 2010 on Windows 7 on my MacBook Air (I kept OSX as well) and I could not be happier. Heck, the initial start-up of the program only takes 3 seconds thanks to the SSD.

As others have mentions, you can run it on OSX using Parallels, etc. but I prefer to run it natively.

aevankoaevanko
12.9k3 gold badges45 silver badges53 bronze badges

I guess you can install it via Parallel or in any other Virtual machine with windows in it

Sebastian PiuSebastian Piu

No. Neither Visual Studio or the .NET framework will run on Mac OSX (although the latter is changing). However, if you want to write an application in a similar framework, you could use Mono and MonoDevelop.

GelatinGelatin
2,1781 gold badge22 silver badges29 bronze badges

There is no native version of Visual Studio for Mac OS X.

Almost all versions of Visual Studio have a Garbage rating on Wine's application database, so Wine isn't an option either, sadly.

Delan Azabani

Microsoft Visual Studio Code Linux

Delan Azabani
63.1k20 gold badges151 silver badges188 bronze badges

While Parallels is technically a VM it is capable of running games in high resolution at a high frame rate. If you run Parallels in Coherence mode it completely integrates Windows 7 into OS X and .Net framework is fully supported. So yes you can install Visual Studio on your Mac however the Apps you created would only run of windows computers unless they were web based.

statuspherestatusphere

Yes, you can! There's a Visual Studio for macs and there's Visual Studio Code if you only need a text editor like Sublime Text.

KuroganiKurogani

Git

Not the answer you're looking for? Browse other questions tagged visual-studiomacos or ask your own question.