First I've got a third party ActiveX control I need to use.
Next I've got to use the stdole library to feed that third party control some images. When I compile under the default settings, I get some 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 that advice and set Embed Interop Types to false for the stdole reference. Everything looks good until I go to the client machine now, when suddenly the application is throwing up 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 guess that's not gonna happen (though I'm not sure WHY removing embed interop on stdole has the effect of making the library unfindable altogether).
Well, let's go the other way and mark everything with Embed Interop true. OOPS! Compile 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 advice on how to get rid of the warnings and have something that can be built and run?
UPDATE
Hans Passant posted as a comment an answer that does indeed solve the problem. If he reposts it as an answer I'll accept it. Unfortunately I'm also having the standard problem where the DLL that's set to Copy Local is nicely copied into its project's release folder, but won't then move along to the final release folder for the solution (a separate executable). I've solved that for now by adding a reference to stdole in my executable. I suppose that's probably good enough.