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!

9 comments:

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 https://msdn.microsoft.com/en-us/library/bb165951.aspx 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.

for IT the said...

Great.. Tutorial is just awesome..It is really helpful for a newbie like me...

JavaScript Online Training JavaScript Online Training JQuery Online Training JQuery Online Training
JavaScript Course | HTML5 Online Training

for IT the said...

Typescript Online Training JavaScript Training Courses | Javascript Online Training | Angular 2 Training in Chennai

for IT the said...

I have read your blog its very attractive and impressive. I like it your blog.

Javascript Training in Chennai | HTML5 Online Training