Running the Microsoft .NET Stack on a Fresh MacBook Pro

Well, after parting ways with Flightdocs, one of the first things I needed to do was get my own laptop and get back to work. The days of spending $2,500–3000 on a nice machine under the generosity of the business were over, and I settled for a slightly smaller, less powerful, but still pricey little MacBook Pro for around $1,800. I suppose there are people in this world that dread setting up a new computer, but for me, it’s one of the best feelings. A brief pause of tranquility and then the rush of excitement that comes with a fresh start and new possibilities.

Since 2005, I’ve worked with .NET, and though at times I’ve cursed Microsoft for so many things, I always come back to C#. Yes, I proudly proclaim myself a polyglot developer who loves new languages, but there is comfort and confidence in the familiar. So, with that in mind, let’s get setup to build enterprise-grade .NET software on our sleek little budget-friendly-not-so-friendly MacBook Pro!

Installation Disclaimer

Not all of the following installations are required, but these are my recommendations for getting setup to be able to cover a variety of common development tasks.

Node.js and NPM

Package managers are fantastic, it’s weird to think that many of us didn’t use them hardly at all even a couple of years ago. I tend to use Node.js for a variety of web development tasks, but even if you’re not going down that route, having NPM is a great way to pull down web-frontend libraries now that bower is deprecated. Head to https://nodejs.orgto download a fresh copy.

XCode

Why XCode when installing Visual Studio? First, Visual Studio for Mac uses many of the Xamarin components which tied in to the development tools for XCode, creating a dependency. Second, you might as well sharpen those mobile skills or at least have a sandbox-knowledge of Swift/Objective C if you are a developer and own a Mac.

Microsoft Visual Studio for Mac

Look at that, I finally got to the part where we install Visual Studio. Head over to https://www.visualstudio.com/vs/visual-studio-mac/and get the bits. There should be a Community Edition that you can start with before shelling out any money. Also, many developers may not realize, but Microsoft does now offer monthly MSDN subscriptions which includes licensing for Professional/Enterprise versions of Visual Studio. Of course, I’m in favor of not spending any money at all if possible.

If you’re not familiar with Visual Studio, it’s a fairly rich (bulky) IDE for development, but the Mac version is quite a bit lighter than it’s Windows counterpart. In my opinion, it’s not as powerful or stable on Mac, but has quite a bit of charm. Since we’re in the Visual Studio for Mac section of this post, let’s briefly talk about Visual Studio Code as well. I recommend also installing Visual Studio Code from https://code.visualstudio.comeven if you don’t write in C# or another similar Microsoft-dominated language. It’s a solid code editor that rivals Sublime, Atom, or Brackets. Visual Studio Code is lightweight, very stable, and extremely extensible. Also, I frequently write my complex API code in the full blown Visual Studio IDE while writing my web application code in Visual Studio Code. Personal preference, I’m sure but I don’t think I’m alone in this combination.

At this point, you’ve got most of what you need to develop .NET applications on a Mac. However, if you actually want to persist any data in your application, you’ll likely need to setup a database.

It is pretty amazing how database offerings have changed in the past five or so years. You’ve got so many options on Linux/Unix based operating systems such as Postgres, MySql, Mongo, and tons more. But, if you’ve been working in MSSQL for the past decade+, you may be blown away to know you can run MSSQL on your Mac as well! Now would be a good time to check outside your window and see if you actually spot pigs flying.

SQLite and MS SQL

SQLite DB is available to run locally on your machine and it’s straight forward. If you’re using Entity Framework, simply point your connection string to a local file and initialize the database. However, if you want an IDE for accessing the data I tried DB Browser for SQLiteand it worked well for me.

Now, onto the really fun stuff — MSSQL on your Mac. You’ll need to install Dockerand a specific image for SQL Server which you can pull using the following command:

docker pull microsoft/mssql-server-linux

Once you’ve got Docker up and running and pulled down this image, you will need to step through a bit of configuration. Microsoft did a nice job of documenting this in the following link: https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker. I’ll wait while you spend the next 15 minutes working it through.

… Intermission …

Done? Fantastic, at this point you should be able to debug a nice WebAPI through Visual Studio for Mac pointing to a full MSSQL database running on Docker, and call everything from your web application that you’re editing through the lightweight Visual Studio Code. Did a few of you cringe at how many Microsoft products you used? Don’t stress! In a few years, the young new developers will start telling all of their Ruby and Python friends about this hot new open source language called C#.

Happy coding my fellow evil-empire-turned-friendly-open-source-contributerfriends.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s