Recently, I have been having some fun with C# and Mono. I decided to try to abandon visual studio, resharper, and windows and start writing from vim on my unix machines. Inspired by Gary Bernhardt and Destroy all Software.
My vim configuration started to become a giant mess, as I started moving from Windows to Ubuntu to OSX. So a few months ago, I totally abondoned my vim configuration in favor of Janus.
Janus, is a vim distro with a bunch of plugins, snippets, and goodies all baked right in. This makes it incredibly easy to switch from your editor of choice to vim.
One of the fun things I learned from one of the Destroy all screencasts is to map ‘,t’ to run your tests from vim.
Instead of using GVim or MacVim, I have been running vi from within iTerm 2/Terminal. Then I map ,t to a command that will run my tests for the current project.
Instead of alt+tabbing back and forth between my editor and shell to run my tests. I can now seemlessly switch back and forth from running tests, to writing code all from one environment.
For building projects, the Mono equivalent to msbuild is xbuild. It’s super easy to use and works as I expected. On Ubuntu you can install via:
To build your csproj, just jump back into your shell and run
I was having some issues trying to figure out how to install packages using NuGet and Mono on both my OSX machine, and Ubuntu machine. Thankfully, I came across this post which helped me finally get things working as expected. nuget on mono
The key to my success was to specify the runtime version. Without it, mono seems to default to the 2.0 runtime, and NuGet uses the 4.0 runtime.
Machine.Specifications runs just fine under Mono. There’s not much for me to say here expect, Thank You!
I ‘borrowed’ DevelopWithPassions continuoustesting script to be able to listen for changes to my .cs files to automatically start running tests in the background, then pop up a growl notification when a test fails. I’m not sure if I prefer having my tests running automatically or if I prefer to control when I want to run my tests. Sometimes it seems like a little to much noise with all the growl notifications, since I tend to save quite often.
I was surprised at how easy it is to write C# outside of the windows eco system. There are still a few things that are kind of annoying. I find it really annoying to have to manually update the csproj file anytime I add or remove a file. I also miss being able to hit alt+enter and allow ReSharper to automatically include the proper namespace. Although, it has been fun exercising my ability to remember which System namespaces need to be included.
I’m having fun with this experiment. ‘nuff said