Tuesday, July 7, 2015

Building/Running the omnisharp-roslyn Project

I've been trying to get involved in the Omnisharp project. Omnisharp is actually a set of projects that are tools to provide many of the experiences present in Visual Studio for other editors like Emacs, Vim, or Sublime. This post is me capturing some of the steps I've gone through to get a part of the Omnisharp project building. Most of this post assumes the reader has an understanding of the DNX environment and its utilities.

Omnisharp has two primary components: a server and a client. The server provides HTTP endpoints that return information about a code base. The client(s) is aa plugin for the user's editor-of-choice that calls the server and uses the data to provide syntax highlighting, code completion, refactorings, etc. The Omnisharp server started life in the omnisharp-server Github project. The latest version is now in the omnisharp-roslyn Github project. It's this project that I've been trying to build.

omnisharp-roslyn provides a build script (either build.cmd or build.sh) to make this a no-brainer. This script tries to set up the local environment, update the required packages, and publish the server. All of this relies on the .NET Execution Environment (DNX). There is nothing wrong with the build script from what I can see. Try it first. I ran into errors with the build script and had to do a few things step-by-step.

Below are the steps I ran to get the omnisharp-roslyn bits running from the code:
dnvm upgrade -unstable
This installed dnx-mono.1.0.0-beta6-12174.
dnvm exec 1.0.0-beta6-12174 dnu restore
This pulled down all the necessary packages.
dnvm use 1.0.0-beta4
This is the version of DNX that omnisharp-roslyn needs.
dnu restore
I'm not sure why.
./scripts/Omnisharp
This runs omnisharp!

You can have Omnisharp index a particular folder or solution file (SLN) by calling:
./scripts/Omnisharp -s /path/to/sln/or/folder