Run exe file added as resource in visual studio

后端 未结 2 1774
抹茶落季
抹茶落季 2021-01-06 15:27

Plainly put, I have added as a resource to a visual studio project an exe file. How do I run this file? I\'m coding in c#.

相关标签:
2条回答
  • 2021-01-06 16:05

    You can take Resource as byte[]

    byte[] myResBytes = ...;
    Assembly asm = Assembly.Load(myResBytes);
    // search for the Entry Point
    MethodInfo method = asm.EntryPoint;
    if(method == null) throw new NotSupportedException();
    // create an instance of the Startup form Main method
    object o = asm.CreateInstance(method.Name);
    // invoke the application starting point
    method.Invoke(o, null);
    

    Also see here for more details

    Hope this helps

    0 讨论(0)
  • 2021-01-06 16:11

    You must use Process.Start method. See it in msdn

    0 讨论(0)
提交回复
热议问题