Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:55:20+00:00 2026-06-13T03:55:20+00:00

have everything working fine with mvc.razor generator. Views from my library project show up

  • 0

have everything working fine with mvc.razor generator. Views from my library project show up fine in my web-site. It is a .net 4.0, MVC4, EF5 project. The app pool is set to .net 4.0 in IIS.

When I deploy to the server, I am getting an exception when it tries to load the PrecompiledMvcEngine type.
Here is the exception (I have attached the full output of error in attachments):

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
System.Reflection.Assembly.GetTypes() +159
RazorGenerator.Mvc.PrecompiledMvcEngine..ctor(Assembly assembly, String baseVirtualPath) +1209
RazorGenerator.Mvc.PrecompiledMvcEngine..ctor(Assembly assembly) +53
MyProj.Common.App_Start.RazorGeneratorMvcStart.Start() in E:\UserFiles\sheam\Documents\Visual Studio 2010\Projects\MyProj\Project.Common_vs2010\App_Start\RazorGeneratorMvcStart.cs:11

As you can see this is coming from my common project.

Here are the contents of the bin director:

2012-10-17 09:06 PM <DIR> .
2012-10-17 09:06 PM <DIR> ..
2012-10-10 12:51 AM 105,528 Antlr3.Runtime.dll
2012-10-09 07:05 PM 1,118,296 EntityFramework.dll
2012-10-16 01:26 PM 359,424 MyProj.Common_vs2010.dll
2012-10-16 01:26 PM 112,128 MyProj.Common_vs2010.pdb
2012-10-09 06:46 PM 45,416 Microsoft.Web.Infrastructure.dll
2012-10-17 09:06 PM 29,696 MyProj.dll
2012-10-17 09:06 PM 42,496 MyProj.pdb
2012-10-13 08:04 PM 15,872 Mvc.Mailer.dll
2012-10-09 06:46 PM 374,784 Newtonsoft.Json.dll
2012-10-09 06:56 PM 15,872 RazorGenerator.Mvc.dll
2012-10-09 06:46 PM 180,832 System.Net.Http.dll
2012-10-09 06:46 PM 168,544 System.Net.Http.Formatting.dll
2012-10-09 06:46 PM 16,480 System.Net.Http.WebRequest.dll
2012-10-09 06:46 PM 138,328 System.Web.Helpers.dll
2012-10-09 06:46 PM 323,168 System.Web.Http.dll
2012-10-09 06:46 PM 73,312 System.Web.Http.WebHost.dll
2012-10-09 06:46 PM 506,976 System.Web.Mvc.dll
2012-10-10 12:51 AM 54,912 System.Web.Optimization.dll
2012-10-09 06:46 PM 264,792 System.Web.Razor.dll
2012-10-09 06:46 PM 41,048 System.Web.WebPages.Deployment.dll
2012-10-09 06:46 PM 204,376 System.Web.WebPages.dll
2012-10-09 06:46 PM 39,512 System.Web.WebPages.Razor.dll
2012-10-09 06:56 PM 8,704 WebActivator.dll
2012-10-10 12:51 AM 963,640 WebGrease.dll
24 File(s) 5,204,136 bytes
2 Dir(s) 1,519,661,289,472 bytes free

RazorGenerator.Mvc.dll exists in there, so I am not sure why it can’t load the type.

The server is a fresh install if W7 Pro.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:55:21+00:00Added an answer on June 13, 2026 at 3:55 am

    Turns out it wasn’t actually razor generator that was the problem. The problem was that a class that RG was loading via reflection, was missing the correct assembly. It was the two Webmatrix assmebly’s.

    Turns out that even if copy local is set (in library project) Visual Studio 2010 and 2012 will not actually copy it over if it exists in the build machine’s GAC. In my case build machine had that assembly installed (by MVC3), but web server did not. I ended up adding those assemblies to my web project (not library) and setting them copy local there.

    This is a nasty bug to find. I build a special exception handler which points this problem out quickly if it happens again. The Start() function in my RazorGeneratorMvcStart looks like this now:

    public static void Start() 
    {
        PrecompiledMvcEngine engine = null;
        try
        {
            engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly)
            {
                UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
            };
        }
        catch (System.Reflection.ReflectionTypeLoadException e)
        {
            StringBuilder exceptions = new StringBuilder("The following DLL load exceptions occurred:");
            foreach (var x in e.LoaderExceptions)
              exceptions.AppendFormat("{0},\n\n", x.Message);
            throw new Exception(string.Format("Error loading Razor Generator Stuff:\n{0}",exceptions));
        }
    
        ViewEngines.Engines.Insert(0, engine as PrecompiledMvcEngine);
    
        // StartPage lookups are done by WebPages. 
        VirtualPathFactoryManager.RegisterVirtualPathFactory(engine as PrecompiledMvcEngine);
    }
    

    Not nice, but I’ll figure out how to make it look nicer, and reusable later. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website using ASP.NET MVC, everything was working fine, but I'd like
I have a ckeditor plugin in my ASP.NET MVC 4 web site. The plugin
So far I've been using ASP.NET MVC 3 BETA. Everything was working fine till
I have Elmah running on my MVC 3 site, and have everything working on
everything is working fine with my jqgrid except a small issue. i have defined
I have an asp:FormView control bound to a datasource. Everything is working fine. If
I have a bunch of self-hosted WCF services. Everything's working fine but I'm look
I have an Asp.Net MVC 2 web application deployed on IIS 7.5 on .Net
I am working with couple of friends on an ASP.NET MVC website. The project
I have a problem with jqGrid and ASP.NET MVC framework. Namely, jqGrid is working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.