Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ASP.NET MVC view precompilation with App_Code helpers?

I am trying to enable view compilation to have my ASP.NET MVC3 web site load faster. My web site is hosted on AppHarbor.

However, my views make use of MVC3 view helpers, defined in the App_Code folder.

When I try to load my web-site, I get: "The directory '/App_Code/' is not allowed because the application is precompiled."

How can I stop the App_Code folder being deployed to the web-server, but still have the App_Code helpers pre-compiled?

I've tried changing the helpers to Content=None, but this leads to an AppHarbor build error because the helper files cannot be found during pre-compilation.

like image 703
Sam Avatar asked Nov 24 '22 13:11

Sam


1 Answers

Old question, but I just got that problem, and the following procedure has worked for me:

  1. Go to https://appharbor.com/your-application.
  2. Click on Settings.
  3. Click on Build | DISABLE PRECOMPILATION.
  4. Force appharbor to do a rebuild/redeploy (by pushing a new commit to the repository).
like image 124
rsenna Avatar answered Dec 30 '22 08:12

rsenna