BuildManager.CreateInstanceFromVirtualPath ignores compiled code
- by Vnuk
This question is related to
http://stackoverflow.com/questions/2158425/why-cant-i-publish-mvc-project
I've replaced System.Web.MVC with its source version. After some debugging I pinpointed my problem to line 50 of WebFormViewEngine.cs:
protected override bool FileExists(ControllerContext controllerContext, string virtualPath) {
try {
object viewInstance = BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(object));
return viewInstance != null;
}
For reasons unknown to me, BuildManager.CreateInstanceFromVirtualPath tries to find masterpage.aspx.vb file which does not exist because MVC application is published.
What makes BuildManager.CreateInstanceFromVirtualPath behave this way, and how to debug?
I've tried this with new blank MVC project. After publishing it and stopping at above location, BuildManager.CreateInstanceFromVirtualPath creates an instance without trying to compile anything.