Index: stable/HeuristicLab.ExtLibs/HeuristicLab.AvalonEdit/5.0.1/HeuristicLab.AvalonEdit-5.0.1/Plugin.cs.frame
===================================================================
--- stable/HeuristicLab.ExtLibs/HeuristicLab.AvalonEdit/5.0.1/HeuristicLab.AvalonEdit-5.0.1/Plugin.cs.frame	(revision 12564)
+++ stable/HeuristicLab.ExtLibs/HeuristicLab.AvalonEdit/5.0.1/HeuristicLab.AvalonEdit-5.0.1/Plugin.cs.frame	(revision 12608)
@@ -27,4 +27,5 @@
   [PluginFile("ICSharpCode.AvalonEdit.dll", PluginFileType.Assembly)]
   [PluginFile("ICSharpCode.AvalonEdit License-5.0.1.txt", PluginFileType.License)]
+  [PluginDependency("HeuristicLab.NRefactory", "5.5")]
   public class HeuristicLabAvalonEditPlugin : PluginBase {
   }
Index: stable/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/HeuristicLab.NRefactory-5.5.0/Plugin.cs.frame
===================================================================
--- stable/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/HeuristicLab.NRefactory-5.5.0/Plugin.cs.frame	(revision 12564)
+++ stable/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/HeuristicLab.NRefactory-5.5.0/Plugin.cs.frame	(revision 12608)
@@ -30,4 +30,5 @@
   [PluginFile("ICSharpCode.NRefactory.Xml.dll", PluginFileType.Assembly)]
   [PluginFile("ICSharpCode.NRefactory License-5.5.0.txt", PluginFileType.License)]
+  [PluginDependency("HeuristicLab.Cecil", "0.9.5")]
   public class HeuristicLabNRefactoryPlugin : PluginBase {
   }
Index: stable/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs
===================================================================
--- stable/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs	(revision 12564)
+++ stable/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs	(revision 12608)
@@ -60,7 +60,12 @@
       foreach (Assembly pluginAssembly in loadedPlugins.Keys) {
         Type plugin = loadedPlugins[pluginAssembly];
+        var pluginFiles = new HashSet<string>(Attribute.GetCustomAttributes(plugin, false)
+            .OfType<PluginFileAttribute>().Where(pf => pf.FileType == PluginFileType.Assembly).Select(pf => pf.FileName));
+        var pluginAssemblies = PluginLoader.Assemblies.Where(a => pluginFiles.Contains(Path.GetFileName(a.Location))).ToList();
+        var referencedAssemblies = pluginAssemblies.SelectMany(a => a.GetReferencedAssemblies()).ToList();
+
         Dictionary<string, PluginDependencyAttribute> pluginDependencies = Attribute.GetCustomAttributes(plugin, false).OfType<PluginDependencyAttribute>().ToDictionary(a => a.Dependency);
 
-        foreach (AssemblyName referencedAssemblyName in pluginAssembly.GetReferencedAssemblies()) {
+        foreach (AssemblyName referencedAssemblyName in referencedAssemblies) {
           if (IsPluginAssemblyName(referencedAssemblyName)) {
             if (!pluginDependencies.ContainsKey(pluginNames[referencedAssemblyName.FullName]))
@@ -87,4 +92,8 @@
         Type plugin = loadedPlugins[pluginAssembly];
         Dictionary<PluginDependencyAttribute, string> pluginDependencies = Attribute.GetCustomAttributes(plugin, false).OfType<PluginDependencyAttribute>().ToDictionary(a => a, a => a.Dependency);
+        var pluginFiles = new HashSet<string>(Attribute.GetCustomAttributes(plugin, false)
+          .OfType<PluginFileAttribute>().Where(pf => pf.FileType == PluginFileType.Assembly).Select(pf => pf.FileName));
+        var pluginAssemblies = PluginLoader.Assemblies.Where(a => pluginFiles.Contains(Path.GetFileName(a.Location))).ToList();
+        var referencedAssemblies = pluginAssemblies.SelectMany(a => a.GetReferencedAssemblies()).ToList();
 
         foreach (PluginDependencyAttribute attribute in pluginDependencies.Keys) {
@@ -93,8 +102,8 @@
           if (pluginDependencyName == "HeuristicLab.MathJax") continue; //is never referenced as this plugin contains HTML files
           if (pluginDependencyName == "HeuristicLab.MatlabConnector") continue; //the matlab connector is loaded dynamically and hence not referenced by the dll
-          var referencedPluginAssemblies = pluginAssembly.GetReferencedAssemblies().Where(IsPluginAssemblyName);
+          var referencedPluginAssemblies = referencedAssemblies.Where(IsPluginAssemblyName);
           if (referencedPluginAssemblies.Any(a => pluginNames[a.FullName] == pluginDependencyName)) continue;
 
-          var referencedNonPluginAssemblies = pluginAssembly.GetReferencedAssemblies().Where(a => !IsPluginAssemblyName(a));
+          var referencedNonPluginAssemblies = referencedAssemblies.Where(a => !IsPluginAssemblyName(a));
           bool found = (from referencedNonPluginAssembly in referencedNonPluginAssemblies
                         select referencedNonPluginAssembly.Name into assemblyName
