Sharing code between 2 projects without a dll

前端 未结 7 1807
孤城傲影
孤城傲影 2020-12-29 23:18

How can I have code-sharing between two projects without making a dll?

The issue is: I have a tool that syncs users & groups from LDAP to a database.

Now

7条回答
  •  北海茫月
    2020-12-29 23:46

    You could:

    • maintain the shared code in a separate project that produces a DLL and then use a tool such as ILMerge to turn the DLL & EXE into one assembly.
    • share the source-files between multiple projects, either by tweakiing your project files or doing something funky with your source-tree layout.

    All that said, the best approach would be to bite the bullet and store the shared code in a shared assembly (DLL). What happens when you decide to, for example, expose this code via a WCF service? It starts getting more complicated then as you have 3 places that reference the same code files. Don't just think about what makes your life easiest now, think about what'll make your life (and that of anyone else who has to maintain the code) easier in the future as well! =)

提交回复
热议问题