private void ClearOnFailingToCompile(string dllPathFile, string modelsHashFile, string projFile) { _logger.LogDebug("Failed to compile."); // the dll file reference still points to the previous dll, which is obsolete // now and will be deleted by ASP.NET eventually, so better clear that reference. // also touch the proj file to force views to recompile - don't delete as it's // useful to have the source around for debugging. try { if (File.Exists(dllPathFile)) { File.Delete(dllPathFile); } if (File.Exists(modelsHashFile)) { File.Delete(modelsHashFile); } if (File.Exists(projFile)) { File.SetLastWriteTime(projFile, DateTime.Now); } } catch { /* enough */ } }