Coming fresh out of code school, everything I knew was about developing in Ruby on my Macbook. Since joining as an apprentice here at Greater Sum, I can say that one of my biggest challenges has been learning to develop in strongly typed languages. Luckily, we focus on building awesome solutions in C# and TypeScript every day.
As an apprentice, we have an ongoing opportunity to increase our status by completing “levels”. These levels help us expand and hone our skills, but we have to prove ourselves by completing a challenge at each stage through a demo.
While it has been quite a learning curve diving into these new languages, I never anticipated just how difficult it would be to work with C# on a Mac. After installing dotNet Core, finding a testing framework, and sampling several IDE’s. I have finally come to an arrangement that I can easily develop in using C#. However, it came with compromises, unexpected roadblocks, and lots of angry curse words. If your curiosity has been aroused about developing in C# on an Apple device… for the beginner, there can be some surprises.
So some background: The dotNet Framework comes preinstalled on pretty much every Windows machine, so you just install Visual Studio and some SDKs – and you’re good to go. With anything other than Windows… it’s a different story. Microsoft decided to make C# platform-independent, but since the dotNet framework is built almost entirely of Windows’ specific system calls- DotNet Core was born.
So here are tips on how to get past some common roadblocks when working with dotNet Core. You can download it by going here. After downloading the SDK and following the instructions, if it’s still not running on your Mac, double check that it was added to your PATH. Even though it explicitly states that it will do this automatically, mine was not, so I had to add it manually.
After making sure it’s added to your PATH, it’s time to choose a tool. We use several JetBrains products here at Greater Sum when working on client software. Being familiar with their products, I decided to install Rider. It’s their latest cross-platform C# IDE. The main reason I decided to use Rider is that it has a tool called Resharper built right in.
Resharper was originally created as a plugin for Visual Studio and was limited to only PCs. Now, with Rider, the same functionality in Resharper is available on every platform. If you’re not familiar with Resharper, it is one of the best refactoring tools on the market. It can save so much time and energy when writing and refactoring code. So, needless to say, Rider has become my preferred IDE for developing C# because of this feature alone.
If you are not interested in using Rider for your C# development, I would suggest either Visual Studio for Mac or Visual Studio Code. Both are great for working in C# and are loaded with features. Though you’ll probably miss having all the excellent suggestions and optimizations that Rider can provide.
After choosing an IDE, you may want to set up a testing environment. Here at Greater Sum, we utilize Test Driven Development, which is a great way to write code with certainty. If your code is covered with tests, you can typically feel confident in changing your code without breaking it.
Here at Greater Sum, we utilize Test Driven Development, which is a great way to write code with certainty. If your code is covered with tests, you can typically feel confident in changing your code without breaking it.
If you are on a Mac, I suggest using XUnit for all your unit testing needs. This is mostly because NUnit for dotnet Core doesn’t exist yet, which was a mistake I made when first setting up my testing environment. Another thing to be careful of is that when you are starting a new project, make sure you are using dotnet Core. When creating a new project, sometimes it comes set up to use dotnet Standard, which is actually a subset of dot net Core. If you choose to use dotnet Standard, it will work for most basic projects, but you won’t be able to install XUnit through Nuget, so you won’t be able to run any tests.
After following those steps, you should be able to develop, write tests, and run tests in C#. I’ve really enjoyed getting to learn several strongly typed languages while working here at Greater Sum. It’s been enlightening, but not without some learning curves. We have built a strong support system at Greater Sum through our daily practices and studies. Because of our passion and emphasis on learning, I have been able to hone my skills quicker than I ever could have imagined. Learning how to develop in C# is just one of the many new skills I am excited to use in my time here. I hope my experience can help shed some light for anyone who, maybe like me, is just learning to use the C# language on an Apple device.