public void Program() { var tempName = "EvilProg-" + Guid.NewGuid().ToString(); AssemblyName aName = new AssemblyName(tempName); AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Save); programModule = ab.DefineDynamicModule(aName.Name, tempName + ".exe", true); programType = programModule.DefineType("Program", TypeAttributes.Public); createReadInInt(); this.program(); var main = functionMap["main"]; programModule.SetUserEntryPoint(main); ab.SetEntryPoint(main); programType.CreateType(); string tempPath = tempName + ".exe"; ab.Save(tempPath); if (File.Exists(Options.ClrExec.Value)) File.Delete(Options.ClrExec.Value); File.Move(tempPath, Options.ClrExec.Value); File.Delete(tempPath); }