Thursday, April 30, 2015

Compile a Visual Studio solution in Visual Studio Code on OSX

Microsoft has launched Visual Studio Code, an IDE for C#, Javascript, Typescript and many more. It is a shell over Atom and runs also on OSX and Linux!

I wanted to see if it is possible to compile a Visual Studio solution (.sln file from Windows) in Visual Studio Code on my Mac (using Mono).

As you can see in the screenshot below; it worked! All I had to do is add a task
(CMD+P => 'Configure Task Runner', this will create and show the tasks.json file. Erase all and just type in the command and the args)

   "command" : "xbuild",
   "args": ["Hello.sln"]

Visual Studio Solution in Visual Studio Code on OSX

SHIFT+CMD+B Builds the solution.

Update: I made a new post how to DEBUG the solution in Visual Studio Code with mono on the Mac!


contradel said...

Hey thanks for the quick guide. How do I compile as release?

Frank said...

Contradel; just add an extra argument in de tasks.json file to set the target configuration:
"command" : "xbuild",
"args": ["/p:Configuration=Release", "Hello.sln"]

contradel said...

Hey Frank. Thank you very much! Works like a charm.

Eden Dragon said...

Hello Frank, I use "yo aspnet" to generate the initial project files. It does not contain a sln(solution) file, how can I make one?

Frank said...

Hi Eden. Solution files are generated and maintained by Visual Studio (not Code) or Xamarin Studio. It is just a readable text-file, thus can be made by hand. See for an explanation of the contents of this file.

Luís de Sousa said...

I just used this guide to get it working on Linux. The easiest way to create a new task is by pressing Ctrl+Shift+B, the rest works pretty much in the same way.

Thanks for sharing. Cheers.

Kelly Petersen said...

I'm working with Visual Studio project on Windows 10. How do you like MAC in use? I heard that it's not bad but it's a matter of habit actually. Several times, I planned to change my PC to MAC book air, but there are so many projects that couldn't be interrupted for convey all my programs to another hardware.
Therefore, I periodically have to install Visual Studio updates, add missing files msvcp120.dll download msvcp120.dll download, in general, it supports the speed and efficiency of my work, but the laptop would have solved a lot of problems related to my mobility of movements,
but for now, I'm sitting at the table expecting better times)

Thank you much!