Index: /trunk/sources/HeuristicLab.Core/PersistenceManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Core/PersistenceManager.cs	(revision 749)
+++ /trunk/sources/HeuristicLab.Core/PersistenceManager.cs	(revision 750)
@@ -26,4 +26,5 @@
 using System.IO;
 using System.IO.Compression;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Core {
@@ -40,5 +41,5 @@
     }
     public static XmlNode Persist(string name, IStorable instance, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
-      if (persistedObjects.ContainsKey(instance.Guid)) {
+      if(persistedObjects.ContainsKey(instance.Guid)) {
         XmlNode node = document.CreateNode(XmlNodeType.Element, name, null);
         XmlAttribute guidAttribute = document.CreateAttribute("GUID");
@@ -52,7 +53,7 @@
       }
     }
-    public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
+    public static IStorable Restore(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
       Guid guid = new Guid(node.Attributes["GUID"].Value);
-      if (restoredObjects.ContainsKey(guid)) {
+      if(restoredObjects.ContainsKey(guid)) {
         return restoredObjects[guid];
       } else {
@@ -72,6 +73,27 @@
     public static void Save(IStorable instance, Stream stream) {
       XmlDocument document = PersistenceManager.CreateXmlDocument();
-
-      document.AppendChild(Persist(instance, document, new Dictionary<Guid, IStorable>()));
+      Dictionary<Guid, IStorable> dictionary = new Dictionary<Guid, IStorable>();
+      XmlNode rootNode = document.CreateElement("Root");
+      document.AppendChild(rootNode);
+      XmlNode necessaryPluginsNode = document.CreateElement("NecessaryPlugins");
+      rootNode.AppendChild(necessaryPluginsNode);
+      rootNode.AppendChild(Persist(instance, document, dictionary));
+      // determine the list of necessary plugins for this document
+      DiscoveryService service = new DiscoveryService();
+      List<PluginInfo> plugins = new List<PluginInfo>();
+      foreach(IStorable storeable in dictionary.Values) {
+        PluginInfo pluginInfo = service.GetDeclaringPlugin(storeable.GetType());
+        if(!plugins.Contains(pluginInfo)) plugins.Add(pluginInfo);
+      }
+      foreach(PluginInfo uniquePlugin in plugins) {
+        XmlNode necessaryPluginNode = document.CreateElement("Plugin");
+        XmlAttribute nameAttr = document.CreateAttribute("Name");
+        nameAttr.Value = uniquePlugin.Name;
+        XmlAttribute versionAttr = document.CreateAttribute("Version");
+        versionAttr.Value = uniquePlugin.Version.ToString();
+        necessaryPluginNode.Attributes.Append(nameAttr);
+        necessaryPluginNode.Attributes.Append(versionAttr);
+        necessaryPluginsNode.AppendChild(necessaryPluginNode);
+      }
       document.Save(stream);
     }
@@ -86,5 +108,12 @@
       XmlDocument doc = new XmlDocument();
       doc.Load(stream);
-      return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
+      XmlNode rootNode = doc.ChildNodes[1];
+      if(rootNode.Name == "Root" && rootNode.ChildNodes.Count == 2) {
+        // load documents that have a list of necessary plugins at the top
+        return PersistenceManager.Restore(rootNode.ChildNodes[1], new Dictionary<Guid, IStorable>());
+      } else {
+        // compatibility to load documents without list of necessary plugins 
+        return PersistenceManager.Restore(rootNode, new Dictionary<Guid, IStorable>());
+      }
     }
 
@@ -111,9 +140,9 @@
       builder.Append(type.Name);
       Type[] args = type.GetGenericArguments();
-      if (args.Length > 0) {
+      if(args.Length > 0) {
         builder.Append("[[");
         builder.Append(BuildTypeString(args[0]));
         builder.Append("]");
-        for (int i = 1; i < args.Length; i++) {
+        for(int i = 1; i < args.Length; i++) {
           builder.Append(",[");
           builder.Append(BuildTypeString(args[i]));
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/DiscoveryService.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/DiscoveryService.cs	(revision 749)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/DiscoveryService.cs	(revision 750)
@@ -117,4 +117,14 @@
       return types.ToArray();
     }
+
+    public PluginInfo GetDeclaringPlugin(Type type) {
+      IPlugin[] plugins = GetInstances<IPlugin>(type.Assembly);
+      if(plugins.Length != 1) return null;
+      IPlugin plugin = plugins[0];
+      foreach(PluginInfo info in PluginManager.Manager.LoadedPlugins) {
+        if(info.Name == plugin.Name && info.Version == plugin.Version) return info;
+      }
+      return null;
+    }
   }
 }
