Help System.Web.Compilation.BuildManager find a type in a non-referenced assembly

Posted by asbjornu on Stack Overflow See other posts from Stack Overflow or by asbjornu
Published on 2010-04-16T10:51:22Z Indexed on 2010/04/23 10:13 UTC
Read the original article Hit count: 258

I'm trying to write a plug-in system where assemblies can be dropped in a folder that ASP.NET has no knowledge about. This plug-in system works fine for ASP.NET MVC based assemblies, but for old-school WebForm assemblies (where the .aspx files Inherits the System.Web.UI.Page derived classes) System.Web.Compilation.BuildManager is responsible for compiling the .aspx file into a dynamic assembly.

My problem is that the BuildManager knows nothing about the assemblies within my plug-in folder and it seems to be absolutely nothing I can do to help it. If I do:

BuildManager.GetType("Type.Defined.In.Plugin.Assembly", true, true)

it throws. If I first get a reference to the Type and then try:

var instance = BuildManager.CreateInstanceFromVirtualPath(path, type);

it still throws, even though I've now passed in the specific type it needs to compile the .aspx file. Is there anything I can do to help BuildManager find the types it needs to compile the .aspx file?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about compile