lundi 20 juillet 2015

Create Dynamic Assembly On New App Domain

I am trying to create a dynamic assembly on a separate app domain as shown here:

string webProfilesNamespace = ConfigurationManager.AppSettings["Profiles.Web.Namespace"];
AssemblyName webAName = new AssemblyName(webProfilesNamespace);
AppDomain webDomain = AppDomain.CreateDomain("WebDomain");
AssemblyBuilder webAsmBuilder = webDomain.DefineDynamicAssembly(webAName, AssemblyBuilderAccess.RunAndSave);

The problem is I keep getting this error when I call DefineDynamicAssebly:

Type 'System.Reflection.Emit.AssemblyBuilder' in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

What do I have to do in order to be able to define dynamic assemblies on a newly created app domain?





Aucun commentaire:

Enregistrer un commentaire