How can a C++ windows dll be merged into a C# application exe?

后端 未结 8 1436
心在旅途
心在旅途 2020-11-28 05:23

I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE.

What are the steps to create such an executable

8条回答
  •  余生分开走
    2020-11-28 05:56

    Have you tried ILMerge? http://research.microsoft.com/~mbarnett/ILMerge.aspx

    ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.

    If you're building the C++ DLL with the /clr flag (all or partially C++/CLI), then it should work:

    ilmerge /out:Composite.exe MyMainApp.exe Utility.dll
    

    It will not work with an ordinary (native) Windows DLL however.

提交回复
热议问题