开发者

Versioning issues with assemblies

Let's assume I have two assemblies:

MyExecutable.dll    version 1.0.0
MyClassLibrary.dll  version 1.0.0

Now, MyExecutable.dll currently uses MyClassLibrary.dll's classes and methods (which include some algorithms). Most of those algorithms were made on the run, being that later I'll want to refine them if needed. This means, I won't change the interface of those classes but the code itself will see some changes.

The question at hand is开发者_开发问答, MyExecutable.dll will be expecting MyClassLibrary.dll 1.0.0 and I'll want it to use version 1.0.1 (or something like that). I don't want to have to recompile MyExecutable.dll(because actually there might be more than just one executable using MyClassLibrary.dll). Is there a solution for this problem? I've heard about the GAC, but if possible I'd like to stay away from it.

Thanks


You are looking for Assembly Binding Redirection - this is a configurable way to tell .NET what version assemblies to use.


The first solution is Assembly Binding redirection, already recommended by Oded.
It is advantageous if you have a smaller .dll and want to make something work with its newer versions.

The second option is creating a separate assembly for the interfaces, and referencing only that from the executable.
This way, you can allow third parties to build stuff against your library without giving them the exact library's assembly. (Eg. they can't decompile it with Reflector, so it is more secure this way.)
As long as the interface assembly doesn't change, you can change other stuff in the library pretty much as you want.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜