Create dynamically an assembly in the current domain.

using System;

using System.Reflection;

using System.Reflection.Emit;

namespace yourProjectname


class Program


static void Main(string[] args)




//Define an assembly name

AssemblyName oAssemblyName = new AssemblyName(“myAssembly”);

//Build the assembly

AssemblyBuilder oAssBuilder =


//Save the assembly as ILOnly working on I386 32 bit processor

//An argument exception will be thrown if you precise the path

// C:\…


Console.WriteLine(“The assembly is dynamically created in the current domain”);



catch (AppDomainUnloadedException caught)








It is also possible to create assemblies in a new domain you just replace currentDomain by createDomain

By Sriramjithendra Posted in C#.NET

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s