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

3

5

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.

Radioman answered 29/10, 2012 at 11:33 Comment(1)
Have you tried to put your html helpers classes to another folder, and compile app?Jefferyjeffie
L
1

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).
Lurette answered 14/4, 2014 at 15:56 Comment(0)
C
0

I have just deleted my shared helpers and deleted the App_Code folder because of this problem. I have changed my project to use partial views instead .

According to this answer helpers must be in the App_Code folder but this won't work using AppHarbor.

Cence answered 17/4, 2013 at 10:34 Comment(0)
D
-1

I would say , don't use App_Code folder in web application. Please find more details ****here****

Devora answered 29/10, 2012 at 12:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.