BuildManager.CreateInstanceFromVirtualPath ignores compiled code
        Posted  
        
            by Vnuk
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Vnuk
        
        
        
        Published on 2010-03-19T11:31:10Z
        Indexed on 
            2010/03/24
            21:23 UTC
        
        
        Read the original article
        Hit count: 1212
        
asp.net-mvc
|debugging
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.
© Stack Overflow or respective owner