How to stop Reflection.Emit from creating a console window?

40 Views Asked by At

I am generating an executable with System.Reflection.Emit (in .NET Framework, so I can save it to disk) and I want the generated exectuable to not have a console window (it should just perform some actions silently in the background).

I tried including a .manifest file, but that had no effect.

1

There are 1 best solutions below

0
Sweeper On BEST ANSWER

Normally you'd do this by setting the output type of the project to "Windows Application".

In Reflection.Emit, you can do the same thing when calling AssemblyBuilder.SetEntryPoint. You can pass PEFileKinds.WindowApplication as the second argument.

assemblyBuilder.SetEntryPoint(yourMainMethod, PEFileKinds.WindowApplication);