Embedding DLLs in a compiled executable

前端 未结 16 2709
情深已故
情深已故 2020-11-21 07:07

Is it possible to embed a pre-existing DLL into a compiled C# executable (so that you only have one file to distribute)? If it is possible, how would one go about doing it?<

16条回答
  •  南方客
    南方客 (楼主)
    2020-11-21 07:46

    You could add the DLLs as embedded resources, and then have your program unpack them into the application directory on startup (after checking to see if they're there already).

    Setup files are so easy to make, though, that I don't think this would be worth it.

    EDIT: This technique would be easy with .NET assemblies. With non-.NET DLLs it would be a lot more work (you'd have to figure out where to unpack the files and register them and so on).

提交回复
热议问题