Entry Point Not Found when adding external DLLs using RegisterVirtualPathFactory(engine)

Mar 13, 2015 at 3:19 AM
Hi guys,

Just for context, I have a small web project with one Model and View. I want to add that to my main project by dropping the DLL in the bin folder.

In the main project, I'm adding assemblies using a PreApplicationStartMethod
foreach (assembly in assemblyList)
{
BuildManager.AddReferencedAssembly(assembly);
}
Then in Global.asax.cs, I try to insert the engines like so
var engine = new PrecompiledMvcEngine(assembly);
engine.UsePhysicalViewsIfNewer = true;

ViewEngines.Engines.Insert(0, engine);

// StartPage lookups are done by WebPages. 
VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
I keep getting Entry Point Not Found when I load my website. DLLs don't have entry points, right?
[EntryPointNotFoundException: Entry point was not found.]
   System.Web.WebPages.IVirtualPathFactory.Exists(String virtualPath) +0
I searched for similar issues, some suggested checking the web.config of both projects. Nothing worked. Any help would be appreciated.
Coordinator
Mar 13, 2015 at 10:43 PM
I'd guess there are some outdated WebPages assemblies, or something like that.
Mar 16, 2015 at 12:33 AM
Edited Mar 16, 2015 at 12:33 AM
Yeah, that was it. Thanks Dave.

Now I only have one custom View Engine in the main project that does
protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath)
{
   if (the controller is a plugin)
   {
      Type type = controllerType.Assembly.GetTypes().Where(t => typeof(WebPageRenderingBase).IsAssignableFrom(t) ...

      // some stuff

      return new PrecompiledMvcView( ...
   }
}
Can I do the same for CreatePartialView?

I wonder how this would behave when paired with embedded resources.