开发者

Packaging same code for using in different contexts

My work involved creating various tools and utilities for in-house use for automation purposes.

Some of my actions are packed all together in one DLL file.

This DLL is then wrapped in another DLL for use from within 1 automation tool, while it is packed in another DLL to be used in another tool (for example -- FinalBuilder).

It is then repackaged as an Executable for running as a standalone tool.

My question is -- did anyone encounter any scenario like this, where multiple small "actions" or utilities need to be reused in various contexts开发者_如何学JAVA (finalbuilder, standalone, etc) ?

If so, is there any easier option to be able to define these once and be able to use them in various locations, instead of writing additional wrappers all the time ?

Thanks


I don't understand the need to "wrap" your shared code dll in another dll.

If your code is shareable, then it should be in a library (with its own namespace(s)). Any number of applications can link to (reference) this library. To deploy the applications, they will all just need a copy of the library assembly next to their .exe file - no wrapping required.

If you wish your .exes to be single files with no additional dlls, then you can use a utility like ILMerge to merge the assemblies together to form a single coherent binary.

A last option is to make multiple csharp projects that share the same source code, so you simply "include" the shared code into all your .exe projects. This would mean you build a single .exe without any need to ship extra dlls or use ILMerge to merge the assemblies after compiling. The down side of this is just that you have to build all the library code every time you build your .exe, so your builds will probably be slower. (And whatever you do, don't make multiple copies of the source code - if you wish to update the shared library it is essential that there is only one master copy of all the source code)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜