mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Fix Razor views re-compilation
When modules are switched from dynamically compiled (.csproj) to precompiled (.dll), Razor views were sometimes not recompiled because the list of virtual path dependencies didn't contain any path that would change during the switch. The fix is to include "~/App_Data/Dependencies/Dependencies.xml" as a virtual path dependency, as this file changes when module configuration changes. Work Items: 16833 --HG-- branch : dev
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.FileSystems.AppData {
|
||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Data;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
|
||||
@@ -56,6 +55,10 @@ namespace Orchard.FileSystems.Dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetViewCompilationDependencies() {
|
||||
yield return _appDataFolder.GetVirtualPath(this.PersistencePath);
|
||||
}
|
||||
|
||||
private IEnumerable<DependencyDescriptor> ReadDependencies(string persistancePath) {
|
||||
Func<string, XName> ns = (name => XName.Get(name));
|
||||
Func<XElement, string, string> elem = (e, name) => e.Element(ns(name)).Value;
|
||||
|
@@ -23,5 +23,6 @@ namespace Orchard.FileSystems.Dependencies {
|
||||
DependencyDescriptor GetDescriptor(string moduleName);
|
||||
IEnumerable<DependencyDescriptor> LoadDescriptors();
|
||||
void StoreDescriptors(IEnumerable<DependencyDescriptor> dependencyDescriptors);
|
||||
IEnumerable<string> GetViewCompilationDependencies();
|
||||
}
|
||||
}
|
||||
|
@@ -55,6 +55,10 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
provider.AddVirtualPathDependency(virtualDependency);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var virtualDependency in _dependenciesFolder.GetViewCompilationDependencies()) {
|
||||
provider.AddVirtualPathDependency(virtualDependency);
|
||||
}
|
||||
}
|
||||
|
||||
public void CodeGenerationCompleted(RazorBuildProvider provider, CodeGenerationCompleteEventArgs e) {
|
||||
|
Reference in New Issue
Block a user