if you want to create an assembly dynamically in the current domain, this is a method to perform this:
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace yourProjectname
{
class Program
{
static void Main(string[] args)
{
try
{
//Define an assembly name
AssemblyName oAssemblyName = new AssemblyName("myAssembly");
//Build the assembly
AssemblyBuilder oAssBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly(oAssemblyName, AssemblyBuilderAccess.Save);
//Save the assembly as ILOnly working on I386 32 bit processor
//An argument exception will be thrown if you precise the path
// C:\...
oAssBuilder.Save(@"myAssembly.dll");
Console.WriteLine("The assembly is dynamically created in the current domain");
Console.Read();
}
catch (AppDomainUnloadedException caught)
{
Console.WriteLine(caught.Message);
}
}
}
}
It is also possible to create assemblies in a new domain you just replace currentDomain by createDomain

Bechir BejaouiPosted Jul 12, 2008, 1:17 PM
Thank you for the advise Mahesh:.)
Mahesh ChandPosted Jul 6, 2008, 9:09 AM
One way I do is, copy my code from Visual Studio to a word document and then copy word doc to here. It adds HTML color coding and formatting for me. See your blog now ;-)
Bechir BejaouiPosted Jul 6, 2008, 8:49 AM
Hi mahesh, I tryed but it doesn't work.
Mahesh ChandPosted Jul 5, 2008, 2:36 PM
Looks like code format in your blog is messed up ;)