2
votes

I am including Olectra Chart, a third-party graphics package, into a VB.Net project, but am plagued with the following warnings:-

vbc : warning BC40059: A reference was created to embedded interop assembly 'Interop.OlectraChart2D' because of an indirect reference to that assembly from assembly 'AxInterop.OlectraChart2D'. Consider changing the 'Embed Interop Types' property on either assembly.

vbc : warning BC40059: A reference was created to embedded interop assembly 'Interop.OlectraChart2D' because of an indirect reference to that assembly from assembly 'MyClassLibrary'. Consider changing the 'Embed Interop Types' property on either assembly.

These appear to prevent the necessary dlls from being included in the bin directory, resulting in exceptions at run-time.

Edit: Exception thus:-

System.IO.FileNotFoundException: Could not load file or assembly 'Interop.OlectraChart2D, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'Interop.OlectraChart2D, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'

I have noted the answers given here and here, and have tried all possible combinations of Embed Interop Types values in the property panel for AxInterop.OlectraChart2D and Interop.OlectraChart2D but none of them clears the warnings without creating compilation errors.

Including the project in a different solution brings different warnings:-

COM Reference 'OlectraChart2D' is the interop assembly for ActiveX control 'AxOlectraChart2D' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.

but the output bin directory is fine.

I can clear the run-time exception by copying the dlls into the bin directory from other solutions but that doesn't seem right to me. Does anyone know what I should do to fix this properly?

1
The warnings are benign, the exception is of course not. You completely forgot to document what it looked like. Clearly you ought to use the vendor's support channels to find help with this particular ActiveX control. Consider the .NET Chart control as a substitute without the hassles.Hans Passant
@HansPassant, thanks for the tip. I am giving the .NET chart close consideration, as it appears that the Olectra vendor has gone to the Great Software House in the Sky.Brian Hooper

1 Answers

1
votes

my answer from this question might also solve your issue: Cannot be used across assembly boundaries because it has a generic type parameters that is an embedded interop type

the answer:

I fixed this by making sure that all assemblies had "Embed Interop Types" to FALSE.

It seems that usually when you use a COM library that parameter is set to true by default.