process.start() embedded exe without extracting to file first c#

后端 未结 5 2311
南方客
南方客 2020-12-03 11:47

I have an executable embedded into my app resources. ATM I use assembly reflection to extract the executable to its own file and then start the executive using process,START

5条回答
  •  囚心锁ツ
    2020-12-03 12:17

    Very simple actually:

    byte[] bytes = File.ReadAllBytes(path);
    a = Assembly.Load(bytes);
    

    Now instead of reading the bytes from a file, read it from the resource and you're done. Actually there is a very good article on that: Dynamically Loading Embedded Resource Assemblies

提交回复
热议问题