AppHarbor, Nancy and the Could not load file or assembly 'Nancy.ViewEngines.Razor.BuildProviders' error

Posted by Marcus Hammarberg on March 6, 2013
I've built a small application. Just something I threw together with a friend during a hack-session at the client. (It's a dot voting application and you can try it here, if it's up :))

As we wanted something out there fast we built it with NancyFx and MongoDB (a first for me) and we host it on AppHarbor with continuous delivery via GitHub. Since all of these (saved Mongo) has served me well in the past I was very surprised when we ran into problem.


When a commit is pushed to AppHarbor the application is compiled and the test (if any) are run. That worked fine for us but then a stage is run that's called "Site precompilation".

That failed with the following error:
error ASPCONFIG: Could not load file or assembly 'Nancy.ViewEngines.Razor.BuildProviders' or one of its dependencies. The system cannot find the file specified.
This had me for quite awhile when I got a tip on "disabling precompilation". In fact, the log tells me so also, at the very bottom:
Website precompilation failed with exit code 1. Precompilation can optionally be disabled in application settings
The only thing was that I didn't understand the log. Hmmm ... haven't I been here before?

OK, cutting to the chase here. The last part of the log comes from AppHarbor  In fact the precompilation is a AppHarbor thing that can be turned off.
Go to [your application]->Settings->Build and click the "Disable precompilation"-button. It's enabled by default.

That made my application compile and being deployed. Where back on the SuperDuperHappyPath.

That problem cost us a lot of trial and error... and frustration. But now you don't have to experience the same thing.



Published by Marcus Hammarberg on Last updated