PreemptPhysicalFiles ignored on partial views


The PreemptPhysicalFiles = false works for views, but when RenderPartial is called the cshtml file from assembly is used even the file exist on disk.

There is missing condition for PreemptPhysicalFiles in FileExists, but the condition is present in CreateInstance. I fixed it by overriding the FileExists method.
public class PrecompiledMvcEngineFixed : PrecompiledMvcEngine
        protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
            if (!PreemptPhysicalFiles && VirtualPathProvider.FileExists(virtualPath))
                // If the physical file on disk exist and the user's opted in this behavior, serve it instead.
                return false;
            return base.FileExists(controllerContext, virtualPath);
Note that it works OK when engine is added at the end:
However it does not work when engine is put at the 1st place:


davidebbo wrote Feb 18, 2013 at 8:36 PM

Could you send a pull request with the change? Thanks!

pub wrote Feb 19, 2013 at 11:23 AM