Index: trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 1796)
+++ trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 1797)
@@ -8,4 +8,6 @@
 using HeuristicLab.Persistence.Default.Decomposers.Storable;
 using System.Text;
+using System.Reflection;
+using System.IO;
 
 namespace HeuristicLab.Persistence.Core {
@@ -35,18 +37,40 @@
     public List<TypeMapping> TypeCache {
       get {
-        List<TypeMapping> result = new List<TypeMapping>();
-        foreach (var pair in typeCache) {
-          string serializer = null;
-          IFormatter f = configuration.GetFormatter(pair.Key);
-          if (f != null) {
-            serializer = f.GetType().AssemblyQualifiedName;
-          } else {
-            IDecomposer d = configuration.GetDecomposer(pair.Key);
-            serializer = d.GetType().AssemblyQualifiedName;
-          }
-          result.Add(new TypeMapping(pair.Value, pair.Key.AssemblyQualifiedName, serializer));
+        BuildTypeCache();
+        return externalTypeCache;
+      }
+    }
+
+    public List<string> RequiredFiles {
+      get {
+        BuildTypeCache();
+        return requiredFiles;
+      }
+    }
+
+    private List<TypeMapping> externalTypeCache;
+    private List<string> requiredFiles;
+    private void BuildTypeCache() {      
+      externalTypeCache = new List<TypeMapping>();
+      Dictionary<Assembly, bool> assemblies = new Dictionary<Assembly, bool>();
+      foreach (var pair in typeCache) {
+        string serializer = null;
+        IFormatter f = configuration.GetFormatter(pair.Key);
+        if (f != null) {
+          serializer = f.GetType().AssemblyQualifiedName;
+          assemblies[f.GetType().Assembly] = true;
+        } else {
+          IDecomposer d = configuration.GetDecomposer(pair.Key);
+          serializer = d.GetType().AssemblyQualifiedName;
+          assemblies[d.GetType().Assembly] = true;
         }
-        return result;
+        externalTypeCache.Add(new TypeMapping(pair.Value, pair.Key.AssemblyQualifiedName, serializer));
+        assemblies[pair.Key.Assembly] = true;
       }
+      Dictionary<string, bool> files = new Dictionary<string, bool>();
+      foreach (Assembly a in assemblies.Keys) {
+        files[a.CodeBase] = true;
+      }
+      requiredFiles = new List<string>(files.Keys);
     }
 
Index: trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
===================================================================
--- trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs	(revision 1796)
+++ trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs	(revision 1797)
@@ -161,7 +161,11 @@
 
     public static void Serialize(object obj, string filename, Configuration config) {
+      Serialize(obj, filename, config, false);
+    }
+
+    public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies) {
       string tempfile = Path.GetTempFileName();
       try {
-        Serialize(obj, File.Create(tempfile), config);
+        Serialize(obj, File.Create(tempfile), config, includeAssemblies);
         File.Copy(tempfile, filename, true);
         File.Delete(tempfile);
@@ -172,5 +176,10 @@
     }
 
+
     public static void Serialize(object obj, Stream stream, Configuration config) {
+      Serialize(obj, stream, config, false);
+    }
+
+    public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies) {
       try {
         Serializer serializer = new Serializer(obj, config);
@@ -193,4 +202,23 @@
           }
           writer.Flush();
+          if (includeAssemblies) {
+            foreach (string name in serializer.RequiredFiles) {
+              Uri uri = new Uri(name);
+              if (!uri.IsFile) {
+                Logger.Warn("cannot read non-local files");
+                continue;
+              }
+              zipStream.PutNextEntry(new ZipEntry(Path.GetFileName(uri.PathAndQuery)));
+              FileStream reader = File.OpenRead(uri.PathAndQuery);
+              byte[] buffer = new byte[1024 * 1024];
+              while (true) {
+                int bytesRead = reader.Read(buffer, 0, 1024 * 1024);
+                if (bytesRead == 0)
+                  break;
+                zipStream.Write(buffer, 0, bytesRead);
+              }
+              writer.Flush();
+            }
+          }
         }
       } catch (PersistenceException e) {
