Sublime is Sublime 6

So far we have done quite a bit getting sublime up and going for use with .NET work but we still at this point have to compile our code from the command prompt which well sucks. In this post we will look at how to get compiles working from within sublime by adding a custom build system for xbuild.

Go to Tools->Build System->new build. A file will open. Drop in:

{
“cmd”: ["xbuild"],
“path”: “/opt/mono/bin/”,
“working_dir”: “${project_path:${folder}}”,
“file_regex”: “^ (.*)\\(([0-9]*),([0-9]*)”
}

Then save this file named xbuild. You can now choose xbuild as a build platform.

Is is important to note that you have to point at the correct xbuild (I run off trunk so I compile with a /opt prefix if you get from say apt-get it will be some place else) and you must have the correct mcs in your path when doing this. This code also assumes that you have only a single solution in the root folder of your code.

Once this is done you can choose xbuild as your current build provider. Then you can use either f7 or ctrl+b to build your code on demand.

Now we are really starting to get there. In the next post we will look at how to run unit tests from within sublime manually.

2 Comments

  1. Posted March 21, 2014 at 9:28 am | Permalink | Reply

    Is there any difference for compiling on Windows, with msbuild?

    • Posted March 21, 2014 at 9:41 am | Permalink | Reply

      You would have to point to msbuild instead of xbuild but should be roughly the same.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 8,573 other followers

%d bloggers like this: