Dynamic loading: Skip reference assemblies in ~/bin

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-07-03 12:29:40 -07:00
parent 392f4fd7b2
commit 24eb381be3
2 changed files with 11 additions and 2 deletions

View File

@@ -222,6 +222,10 @@ namespace Orchard.Environment.Extensions {
string referenceName, string referenceName,
IList<DependencyReferenceDescriptor> activatedReferences) { IList<DependencyReferenceDescriptor> activatedReferences) {
// Skip references from "~/bin"
if (_buildManager.HasReferencedAssembly(referenceName))
return;
// Binary references // Binary references
var references = context.ReferencesByName.ContainsKey(referenceName) ? var references = context.ReferencesByName.ContainsKey(referenceName) ?
context.ReferencesByName[referenceName] : context.ReferencesByName[referenceName] :

View File

@@ -8,6 +8,7 @@ using Orchard.FileSystems.VirtualPath;
namespace Orchard.Environment { namespace Orchard.Environment {
public interface IBuildManager : IDependency { public interface IBuildManager : IDependency {
IEnumerable<Assembly> GetReferencedAssemblies(); IEnumerable<Assembly> GetReferencedAssemblies();
bool HasReferencedAssembly(string name);
Assembly GetReferencedAssembly(string name); Assembly GetReferencedAssembly(string name);
Assembly GetCompiledAssembly(string virtualPath); Assembly GetCompiledAssembly(string virtualPath);
} }
@@ -23,9 +24,13 @@ namespace Orchard.Environment {
return BuildManager.GetReferencedAssemblies().OfType<Assembly>(); return BuildManager.GetReferencedAssemblies().OfType<Assembly>();
} }
public Assembly GetReferencedAssembly(string name) { public bool HasReferencedAssembly(string name) {
var assemblyPath = _virtualPathProvider.Combine("~/bin", name + ".dll"); var assemblyPath = _virtualPathProvider.Combine("~/bin", name + ".dll");
if (!_virtualPathProvider.FileExists(assemblyPath)) return _virtualPathProvider.FileExists(assemblyPath);
}
public Assembly GetReferencedAssembly(string name) {
if (!HasReferencedAssembly(name))
return null; return null;
return Assembly.Load(name); return Assembly.Load(name);