Linking statically in C#

前端 未结 3 528
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 03:26

I\'m working on a module for a CMS. This module is distributed as a class library DLL.

I have several utility libraries I\'d like to use in this module. Is there any

3条回答
  •  猫巷女王i
    2020-12-14 03:44

    If you don't want to use ILMerge, see this page:

    http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx

    editor's note: Jeffrey Richter advices to put your dlls into exe file as resources (For each DLL file you add, display its properties and change its “Build Action” to “Embedded Resource.”). Then a custom class loader is needed to make the executable work (At runtime, the CLR won’t be able to find the dependent DLL assemblies, which is a problem. To fix this, when your application initializes, register a callback method with the AppDomain’s ResolveAssembly event).

    Be sure to change the resourceName string to point to your actual resources. (e.g. change AssemblyLoadingAndReflection to your project name.)

提交回复
热议问题