Tuesday, June 5, 2012

NancyFx Appharbor builds timing out

I have been working on a petite portfolio site for my girlfriend which is implemented in NancyFx, hosted in ASP.NET. On deploying the project to Appharbor, my builds kept timing out. Since the build log was empty, I turned to Twitter for help. This fine gentleman provided me with a solution.

When you add the Razor view engine to your project using the Nuget package, the postbuild event of your project will be modified to xcopy some assemblies into the bin - which apparently is an Intellisense and precompilation thing.

You do not want to do this in production. Open your project file (or project properties), and change the postbuild event to include a configuration condition.
<PropertyGroup>
    <PostBuildEvent>
      if $(ConfigurationName) == Debug (
        xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\BuildProviders\Nancy.ViewEngines.Razor.BuildProviders.dll" "$(ProjectDir)bin"
        xcopy /s /y "$(SolutionDir)packages\Nancy.Viewengines.Razor.0.11.0\lib\Net40\Nancy.ViewEngines.Razor.dll" "$(ProjectDir)bin"
      )
    </PostBuildEvent>
</PropertyGroup>
I have it on good authority that this will be fixed in the next package.

2 comments:

  1. Just to let you know. This fix is already in our master branch and will be part of the 0.12 release.

    Thanks for spreading the word in the meantime!

    ReplyDelete