First, I have a third-party ActiveX control that I need to use.
Next I have to use the stdole library to feed this third party, controlling some images. When I compile the default settings, I get a few warnings:
warning CS1762: A reference was created to embedded interop assembly 'c:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll' because of an indirect reference to that assembly created by assembly 'XXX\obj\x86\Release\Interop.ThirdPartyControl.dll'. Consider changing the 'Embed Interop Types' property on either assembly. warning CS1762: A reference was created to embedded interop assembly 'c:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll' because of an indirect reference to that assembly created by assembly 'XXX\obj\x86\Release\AxInterop.ThirdPartyControl.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
Easy enough, I'll follow this tip and set the Interbed Interop types to false for stdole help. Everything looks good until I switch to the client machine when suddenly the application calls this:
Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
So, I assume that this will not happen (although I am not sure that removing the built-in interop on stdole will cause the library to be completely excluded).
Ok, let go the other way and mark everything with Embed Interop true. OOPS! Compilation Error:
Error 2 Cannot embed interop types from assembly 'XXX\obj\x86\Release\AxInterop.ThirdPartyControl.dll' because it is missing either the 'ImportedFromTypeLibAttribute' attribute or the 'PrimaryInteropAssemblyAttribute' attribute XXX\obj\x86\Release\AxInterop.ThirdPartyControl.dll XXX Error 1 Cannot embed interop types from assembly 'XXX\obj\x86\Release\AxInterop.ThirdPartyControl.dll' because it is missing the 'GuidAttribute' attribute XXX\obj\x86\Release\AxInterop.ThirdPartyControl.dll XXX
So, any tips on how to get rid of warnings and something that you can build and run?
UPDATE
Hans Passant posted a comment as a comment that really solves the problem. If he repeats this as an answer, I will accept it. Unfortunately, I also have a standard problem when the DLL installed in Copy Local is nicely copied to the project's release folder, but then it wonβt move to the final release folder for the solution (separate executable file). At the moment, I decided by adding a link to stdole in my executable. I suppose that's probably good enough.