I’ve been meaning to write about my development setup for a while now, and having been prompted to think about it again by a post from Kyle Baley, now seems like the right time.

One of my main goals in setting up my development environment is portability. I like multiple monitors and fast machines, but I also have to carry my laptop every day when working in an office, and often work without a desk - I’m sitting on a sofa in a hotel room in Bangkok as I type this. I now run everything on a MacBook Air - possibly an unusual choice for someone who makes a living working on Windows software, but it’s very portable and with SharePoint I have to use virtual machines anyway.

I also considered getting a netbook, but I decided that getting SharePoint running on that may be pushing things a little.

This setup does have a couple of constraints of course - limited memory and limited disk space. However this isn’t too much of a problem if settings are chosen carefully.

For Windows apps I’m using VMWare Fusion 2 with Windows Server 2008.

Although I just have the one VM set up and running all the time, I have a copy of the vm on an external hard drive, from just after installing Windows and Visual Studio. Because I know just how unstable a development VM can get after a few months, especially when doing SharePoint work, I want to be able to replace my active VM with that backup and not lose any code or need a lot of time to get back to writing code. Ideally I should be back to work on a clean system with just a file copy and restart.

This means minimising what I run on the VM - In regular usage this is now just IE, Visual Studio, IIS, SharePoint, SQL Server and IE. All the other stuff I use (mostly Firefox, Skype and Remote Desktop) is very unlikely to become unstable so can run on the host. I might do this a little differently if running Windows as the host though - using Unity makes quite a difference.

The documents and downloads folders I have set up pointing to shared folders on the host - this works really well for accessing files from whichever environment I need to. Unfortunately it doesn’t work for code - Visual Studio doesn’t like network folders.

There are some settings you can change to make Visual Studio trust network folders (see Steve Strong’s post Loading projects in VMs with source on Host), but I haven’t bothered with that as it probably wont work completely enough. I tried to set up something similar a few years ago and ran into other issues with web projects - Namely that Visual Studio sets up a FileSystemWatcher for every file in a web project so that changes will be immediately seen in the browser, and watching for changes on a network drive is quite different to watcing a local drive.

For code I have set up a seperate virtual drive (Code.vmdk), the idea being that I can safely delete/replace the system drive (19GB) and only backup/copy the 1GB file.

I did make one mistake in setting this up - creating database files on the same drive. SQL server transaction log files can get pretty large (increasing the size of the vmdk file) and when you shrink them the vmdk file stays a couple of GB larger than it should be, unless you put in the effort to run sdelete and cleanup. If I was starting again I’d probably create a seperate drive for databases - the databases on a development machine are usually throwaway anyway, so they don’t really belong in the same place as code.

Another goal of my setup (somewhat related to the portability) is having everything stored somewhere other than my laptop. While losing a $4000 laptop is hardly a good thing, it’s pretty insignificant compared to losing $50000 worth of work. I have a couple of ways to deal with this:

I use Google Apps a lot - Gmail is a much safer place for my data than outlook files that I seem to lose every time I reinstall windows. I’ve been using Google Docs instead of Office, and haven’t really missed any features. The only Office app that I kept using using on the VM was OneNote, and getting GDNote usable has changed that too.

For the stuff that still requires local files, I’m using subversion. I used to only upload stuff when it became clear I’d want to keep it, but now I just put everything in there. I have folders set up so that it’s very easy to have TortoiseSvn or SCPlugin upload anything new.

Of course there are one or two things I haven’t got working quite as well as I’d like:

  • Having the host see the VM by name rather than just IP address so I can get the code drive showing up in Finder and use a more consistent URL during testing. Probably really simple, but I haven’t worked it out yet.

Ok, that’s only one thing - guess I’m doing pretty well.

Just realised I’m using GDNote to write this post without really thinking about it - definitely a good sign.