This is what im doing:
byte[] bytes = File.ReadAllBytes(@Application.StartupPath+\"/UpdateMainProgaramApp.exe\");
Assembly assembly = Assembly.Load(bytes);
/
if you check any WinForm application Program.cs file you'll see there always these 2 lines
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
you need to call as well them in your assembly. At least this is what your exception says.
How about calling it in it's own process?
The entry point method is static, so it should be invoked using a null value for the "instance" parameter. Try replacing everything after your Assembly.Load line with the following:
assembly.EntryPoint.Invoke(null, new object[0]);
If the entry point method is not public, you should use the Invoke overload that allows you to specify BindingFlags
.