UPDATE

There is an updated version of this guide here. This version exists for historical reasons only and should no longer be used.

I’m going to use Sublime Text 3 as my editor and I’m assuming you’ll do the same. Sublime Text is not free, but it’s worth paying for. You can use it as a trial so you can do this walkthrough and decide later if you like it or not. You’re free to use whatever you like, but you’ll be on your own getting it set up.

Sublime Text

Getting Sublime Text is easy. Use the latest build number instead of 3065 if you want the latest and greatest. If you’re on a 64-bit system, replace “i386” in the following command with “amd64”.

$ wget http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3065_i386.deb
$ sudo dpkg -i sublime-text_build-3065_i386.deb
$ rm sublime-text_build-3065_i386.deb

OmniSharp

OmniSharp brings a lot of conveniences of Visual Studio, like intellisense, to normal text editors. We’re going to use the Sublime Text Package Manager to install OmniSharp, and you can use it to install many other useful extensions.

To install the package manager, open the Sublime Text console by pressing Ctrl+` and paste in the following command.

import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Restart Sublime Text if it asked you to. We’ll need to install the Kulture plugin before we install OmniSharp. Press Ctrl-Shift-P and type Package Control: Install Package then hit enter. Typing Install is usually enough, though. Enter Kulture into the package list window to install the package. When that is finished, install OmniSharp the same way.

Next, we’ll enable auto-complete in OmniSharp. OmniSharp’s website has good instructions, but the process is simple. Open a C# file and open the “Preferences | Settings - More | Syntax Specific - User” file. Add the following settings and save it.

{
    "auto_complete": true,
    "auto_complete_selector": "source - comment",
    "auto_complete_triggers": [ {"selector": "source.cs", "characters": ".<"} ],
 }

Building Through Sublime

The Kulture plugin allows you to build your application through Sublime by pressing F7. Unfortunately, the plugin tries to execute the build script using sh which on Linux Mint is linked to dash. This shell doesn’t have all the features of bash, so the script fails. I’ve created a pull request to address the issue, but if you want to fix it yourself, you need to edit the ASP.NET.sublime-build file in the Kulture package. To do this, select “Preferences | Browse Packages” in Sublime Text. Navigate to the “Kulture” folder and open the ASP.NET.sublime-build file.

// Replace this line
"cmd": ["sh", "$packages/Kulture/build.sh"],

// With this
"cmd": ["bash", "$packages/Kulture/build.sh"],

That’s it!

Let’s test all this by re-opening the HelloMvc project that we used in the last post. In Sublime Text, select “File | Open Folder” and choose the aspnet-home/samples/HelloMvc directory from wherever you cloned the aspnet-home git repository. Save a project file in the HelloMvc directory by selecting “Project | Save Project As…”. You can name it whatever you want, but the *.sublime-project file should be in the same directory as the project.json file.

Open the project file you just saved and add a “solution_file” entry.

// The project file looks like this by default.
{
  "folders":
  [
    {
      "follow_symlinks": true,
      "path": "."
    }
  ]
}

// Add the "solution_file" entry so the project looks like this.
{
  "folders":
  [
    {
      "follow_symlinks": true,
      "path": "."
    }
  ],
  "solution_file": "."
}

Save the project file. Then, select “Tools | Build System | ASP.NET” in Sublime Text to enable building the project. Restart Sublime Text and everything should start working. Press Ctrl-B to test that the build works. Next, open HomeController and within a method body, try typing string.Is. If everything went ok, you should see options pop up. It may take a moment for the very first suggestions to pop up, but it should be quick after that.

Next time, we’ll get our project started!