Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a custom VirtualPathProvider with a PreCompiled website

currently I have a custom VirtualPathProvider in a Asp.net MVC web application.

This VirtualPathProvider checks the Area from the route "/{Area}/{Controller}/..." and uses the NameSpace.{Area}.Main.dll module to return the views that are contained in that assembly as Embedded Resources.

This works great and I don't have to deploy any ascx, js, css files.

Now my problem is this:

I would like to precompile the aspx and ascx files in the assembly and instead of having the views as embedded resources I would have the view class with the Response.Write.

I can precompile the views using the aspnet_compiler but I keep getting an error when ever the ViewEngine tries to find the view and fails.

My main goal is to have a way for the first time usage of a certain view/usercontrol would be faster and don't wait for the compilation to happen.

This is a requirement since the application could be grouped into plugins and this plugins be deployed into the Bin directory.

Any thoughts?

like image 404
Carlos Sobrinho Avatar asked Dec 11 '09 14:12

Carlos Sobrinho


1 Answers

This VirtualPathProvider In Precompiled Web Sites blog post by Coskun SUNALI describes a solution using reflection. Please note that he makes it very clear that this is not an officially supported solution from Microsoft but judging by the comments on his blog post it seems to be working well for some people.

like image 132
Martin Hollingsworth Avatar answered Dec 05 '22 22:12

Martin Hollingsworth