Assembly exeAssembly = Assembly.Load(bytes); var entryPoint = exeAssembly.EntryPoint; var parms = exeAssembly.CreateInstance(entryPoint.Name); entryPoint.Invoke(parms, null); 

The exe read in the byte array does not start, throwing an exception

System.BadImageFormatException: "Failed to load file or assembly" 594432 bytes loaded from WindowsFormsApp7, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null "or one of their dependencies. An attempt was made to load a program that has the wrong format."

What could be the reason? Versions changed, exe exactly working.

  • Well???????????? - Qwertiy
  • Oh yes. What could be the reason? Versions changed, exe exactly working. - Rodion Larin
  • 3
    This exception can be thrown out if the assembly you are downloading has the wrong format (for example, the assembly is unmanaged) or it requires the CLR version higher than the target version - Artyom Okonechnikov
  • And is it possible to run any? - Rodion Larin
  • Can you specify the task you need to perform? If you just need to run the exe, then it is easier to write it to a file and start the process. - default locale

0