开发者

If assembly is added to the GAC, do all assemblies it references also need to be added there too?

Background Info:

I have two COM+ components on a remote server, based on .NET assemblies, one of which calls the other, which in turn calls a private assembly.

My chain of calls looks like this;

Client Machine:

Test Harness -> Initialises COM+ component "TestFirst" through Activator.CreateInstance(...), which routes via COM+ application proxy, then calls a method on the instance.

Remote Server:

TestFirst -> Method call from client initialises a COM+ component "TestSecond" through "new" keyword use, then calls a method on the instance.

TestSecond -> Calls a method on a class contained in a private assembly; "TestThird"

The Problem:

In order for the TestSecond to be called successfully, it seems that I have to install the assembly to the GAC. Otherwise, I get this error;

Cannot load type 'TestSecond.TestSecond, TestSecond, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...'.

OK, so I add TestSecond.dll to the GAC and then...

Could not load file or assembly 'TestThird, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...' or开发者_如何转开发 one of its dependencies. The system cannot find the file specified.

The obvious answer here is to add TestThird to the GAC too, which does work, but I would prefer not to go down this road. This is just a proof of concept, and the actual project which follows this structure has many private assembly references and I would like to avoid adding them all to the GAC just so these COM+ components can see them.

Is there any alternative? Is there perhaps some way of associating a working directory with a GAC registered assembly?

Note: This question is tangentially related to another question I asked during the week, but I'm specifically focusing on the dependency resolving of GAC installed assemblies.

COM+ component calling other COM+ components - "Cannot load type"


You can make your assemblies load their dependent assemblies from whatever install path you choose:

http://www.chilkatsoft.com/p/p_502.asp

(No association with that company, their example just seemed relatively clear.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜