-1

I have created a COM DLL in C#. In this DLL I am linking against a third party DLL ("thirdpartydll.dll"). When I set "thirdpartydll.dll" to be output into the Release folder during the compilation, all works fine.

But I do not want to distribute "thirdpartydll.dll" with my DLL. I would like my DLL to use the "thirdpartydll.dll" that may (or may not) have been registered by the third party.

For example, if the third party installed "thirdpartydll.dll" to C:\Program Files (x86)\Third Party\thirdpartydll.dll, then my COM DLL should use this.

Currently this does not work. I get the automatic error 80070002. I guess it means that my COM DLL can not find "thirdpartydll.dll". I am not sure why. I thought my COM DLL would find it automatically.

Filburt
  • 17,626
  • 12
  • 64
  • 115
tmighty
  • 10,734
  • 21
  • 104
  • 218
  • Do you want to be able to dynamically check whether this dll is in the GAC and act accordingly? Because that is doable but [messy](http://stackoverflow.com/questions/19456547/how-to-programmatically-determine-if-net-assembly-is-installed-in-gac) - edit: I misunderstood your third pargraph, this dll is required its the path that varies. – Nathan Cooper Mar 03 '14 at 11:06
  • No, that would not help. – tmighty Mar 03 '14 at 11:07

1 Answers1

0

If you do not want to care where (non COM) thirdparty.dll is installed on the target system, it has to be install into the Global Assembly Cache (GAC).

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • I wrote the same class in C++, using the DLL's .tlb file, and it worked. The DLL was found dynamically. So I guess I am just doing something wrong in C#. The thirdpartydll.dll is not in the GAC. – tmighty Mar 03 '14 at 11:11