Working with older .NET projects in Mac OS

Where I work many of our web projects are built-up using a .NET-based backend (usually an MVC/WebAPI/Nancy application) and an HTML + Javascript frontend. All the developers, including myself, are using a Mac with Mac OS running natively. However when working with .NET it is natural to run Visual Studio - so each of us has a virtual Windows 8 with VS and IIS.

The pure frontend developers prefer to work inside Sublime Text and they seldom need to make changes in the underlying .NET code. So forcing them to work inside VMWare etc. instead of in Mac OS just slows them down and makes it harder. One of my coworkers Dennis Pettersson (https://github.com/ankjevel/) has built a neat application, 'vm', that allows us to access and rebuild our .NET code directly from Mac OS.

Getting started

First of all, you need a Windows machine running inside VMware Fusion. I am using Windows 8 with Visual Studio 2013 and IIS. I have also disabled the Windows firewall so I can connect to all of the websites hosted via IIS.

You also need to have your .NET project lying somewhere on your Mac where your virtual machine is able to reach it as a shared folder. In this example I have my code inside ~/src on my Mac, so the path where my virtual Windows can access the source looks like this: \\vmware-host\Shared Folders\ilix\src.

The next step is to download and compile 'vm' from GitHub. You can find the project and instructions here: https://github.com/ankjevel/vm

When that is done you can run vm to compile your .NET code.

In this example I use a project called 'MobilityLayer'. So my vm command looks something like this: vm -u ITEAM\\acr -p s3cr37 -t /t:build -s "\\\\vmware-host\\Shared Folders\\ilix\\src\\Web_MobilityLayer\\MobilityLayer.sln" -o /property:Configuration=Debug -y

The build output comes from MSBuild inside Windows

The project is setup as a website in IIS so I can access it from the browser on my Mac on the virtual Windows machine's IP.

At this point I am able to make changes to my .NET code in my editor of choice on the Mac and recompile whenever I need to. All of this without ever having to manually access the virtual Windows machine!

comments powered by Disqus