Fix bugs with migration runner and add VS2012 solution file

Details are explained in the commit notes for each commit.