herzbube
herzbube

Reputation: 13378

How to resolve .NET dependency of COM component?

This is my current deployment scenario:

This is how it is supposed to work:

The problem: The C++/CLI wrapper cannot find the .NET assembly and the application crashes.

Solutions I can think of so far:

For various reasons none of these solutions seem particularly attractive. Do you know of any other mechanism how this problem can be solved? The ideal solution would use some sort of configuration on the SDK side, but as far as I know it is not possible to give assemblies a .config file, or is it?

As I am not particularly .NET savvy, I would also be grateful for comments on the "resolver routine" solution. Is this something that people routinely do, or is it something exotic that should be avoided for some reason?

Upvotes: 1

Views: 209

Answers (1)

loic
loic

Reputation: 185

In my mind, what you called the "resolver routine" is the best solution. Since your assembly is loaded into the default context, the search paths contains the client application current folder, not the folder of the assembly. Rearding this article, this is a typical case for using AppDomain.AssemblyResolve event. I guess you can either load your assembly into a custom context but it sounds a bit too much to me (just my two cents)

I hope this helps

Upvotes: 1

Related Questions