4 minute read

A couple of days ago Jetbrains released the first version of Project Rider in an early access program. If you know me personally you probably are aware that I have been drooling over the prospect of trying it since it was announced last January. I started out writing lots of C#, am currently running Ubuntu 15.10 and have always been (and hopefully always will be) a big fan of ReSharper and Jetbrains IDEs in general. I thought this would be a good opportunity to see how Rider holds up on Ubuntu. For the record, I am running Ubuntu 15.10, so any instructions you see here may vary depending on your system.

Getting started

First of all: If you want to execute any C# code on Linux, you will need a .NET runtime - in our case mono. It can be easily installed from the command line:

sudo apt-get install mono-complete

Note that this is not actually needed to start RiderRS. Without the runtime you won’t be executing any code though, so we might as well get that out of the way. Besides, if a runtime is installed Rider automatically selects it for execution, thus creating a first project is less of a fuss.

Let’s start it up and create a new console application. I wouldn’t worry too much about the other project types right now. Let’s choose a name, click continue and the next thing we see should be our project, with references and all that stuff. Next we’ll write some code. I just created Calculator.cs and edited Program.cs to fit my needs.

public class Calculator
{
    public int Add(int x, int y)
    {
        return x + y;
    }
    public int Substract(int x, int y)
    {
        return x - y;
    }
    public double Divide(int x, int y)
    {
        return x/y;
    }
}
class Program
  {
    static void Main(string[] args)
    {
        int a = 1;
        int b = 2;
        Calculator calculator = new Calculator();
        int additionResult = calculator.Add(a, b);
        Console.WriteLine("Addition result: " +additionResult);
        int substractionResult = calculator.Substract(a, b);
        Console.WriteLine("Substraction result: " + substractionResult);
        double divisionResult = calculator.Divide(a, b);
        Console.WriteLine("Division result: "+ divisionResult);
    }
  }

Keep in mind that this IDE is in early access, so it is not supposed to be perfect. A couple of things that I noticed though: Code completion is a bit wonky sometimes. Adjusting code style for C# code is not possible ATM. There are no live templates for C#. Looking at the bug tracker we can see that other people have that problem too. Anyway, who cares about that. Run that sucker and behold. We just executed a trivial C# program on an Ubuntu system.

Nuget and NUnit

Great, so we can actually write some C# code and execute it. But what if we want to do some not so trivial stuff. Can we download libraries using Nuget? Can we execute tests using NUnit? How about using something like RestSharp? Let’s find out.

First things first, let’s install Nuget.

sudo apt-get install nuget

In order to download any Nuget packages we will need to add the Mozilla LXR certificate, else we might get a ‘Invalid Certificate’ warning and Nuget will fail to find any packages.

mozroots --import --sync 

We can try if Nuget works properly by listing all available packages.

nuget list

Now we should be able to execute Nuget from Rider. If it’s not open yet open the Nuget Tool window (using View -> Tool Windows -> Nuget). A restart of Rider might be necessary if you don’t immediately see it. After that we’ll install NUnit and see if we can run some unit tests. Let’s create a new Project. In the newly opened tool windows we’ll search for NUnit, select a version and install it for the new project. After that is done we should see a new reference and the packages.config beeing added.

I did not reference the actual project, because that somehow messed up my build (it always complained that RiderJS could not be found). Well, we will write some tests which don’t actually do anything then.

using NUnit.Framework;

namespace UnitTests
{
    [TestFixture]
    public class CalculatorTests
    {
        [Test]
        public void Add()
        {
            int result = 1 + 2;
            Assert.AreEqual(3, result);
        }
    }
}

Now, we’ll find out that we can neither build nor run the new project individually. Also, there is no pre-made configuration for running tests. I fully expect that to be added in the future, but for now, we will use nunit-console. Install it using apt-get.

sudo apt-get install nunit-console

Then we will build the test project. The only way I found was to add a composite run configuration consisting only of the test project. Once that is done, we move to the build folder and can execute nunit-console Tests.dll. Hopefully we receive the following output, which means that our test has passed (big surprise, really).

NUnit-Console version 2.6.3.0
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment - 
   OS Version: Unix 4.2.0.23
  CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 3.2.8 (Debian 3.2.8+dfsg-4ubuntu4) ) )

ProcessModel: Default    DomainUsage: Single
Execution Runtime: mono-4.0
.
Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0171226 seconds
  Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Conclusion

To conclude, I had some fun playing around with the new IDE and getting some stuff to work, but it is evident that there is much more work to be done. Which is not in the least suprising. I’m looking forward to playing around some more in a couple of months. Go Jetbrains!

Updated: