Lately I have been working on an application that I host in AppHarbor, great service check it out if you are looking for a .net platform as a service provider.
Deploying your applications to AppHarbor is very smooth, all you have to do is push your git repository to their servers. Then they take care of building your application, running included unit tests, and finally deploying the application.
One thing that you will quickly figure out, is that if you use some 3rd party libraries you will have to include them as part of your solution and reference them in your projects from your local folder. That is understandable as they have no way of knowing which 3rd party libraries you could be interested in using.
Another gotcha that I discovered yesterday, is that if you use private accessors to unit test private methods, then this will make your unit test fail as appharbor is unable to create the assembly containing the accessors. I believe the reason for this is that in order to build the private accessors assemblies Visual Studio and the tools that come with it have to be installed on the build server, something which probably isn’t the case of the AppHarbor build servers. But fear not there is a simple solution to the problem.
First you have to find Publicize.exe in your Visual Studio installation in my case it was located at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. This is a nifty little tool that can generate the private accessor assemblies to the assembly containing the private methods that your want to unit test. Read more about it here.
Add this tool to your git repository that you push to AppHarbor, that way we can execute it as part of the build process and have it generate the assembly we need.
I did that by adding a post-build event to the project that contained the private methods I was unit testing. See the screenshot.
My post-build event command line was (of courses yours should point to the folder where you have publicize.exe located and AudioSuggestions.dll should be replaced with the name of the dll that you are running tests against.
"$(ProjectDir)..\library\publicize.exe" /target:Desktop "$(OutputDir)AudioSuggestions.dll"
Now instead of letting Visual Studio add the accessor files to my test project I simply referenced the assembly build as part of the Post-build event. This makes me able to run the unit tests locally, but it also lets me run the unit tests in AppHarbor which was the goal. (An alternative solution is of course to add the private accessor assembly to your repository and that way push it to AppHarbor, but I feel this solution is better, as your private accessor assembly is build by AppHarbor and thus always is up-to-date.)