The C# project I work on has an assembly with a reference to stdole.dll
which on my dev PC is located in C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
.
I'm not sure where this assembly came from originally. I noticed that there is a Nuget package that provides it: https://www.nuget.org/packages/stdole/17.0.0-previews-1-31314-256 although we weren't using this.
My assembly had been using the preexisting GAC file; when I switched from the GAC stdole reference to the Nuget version, the following was removed from my CSPROJ:
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
and this added instead:
<Reference Include="Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\hap\Build\packages\Microsoft.VisualStudio.Interop.17.0.0-previews-1-31314-256\lib\net472\Microsoft.VisualStudio.Interop.dll</HintPath>
</Reference>
<Reference Include="netstandard" />
<Reference Include="stdole, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\hap\Build\packages\stdole.17.0.0-previews-1-31314-256\lib\net472\stdole.dll</HintPath>
</Reference>
The GAC file had version 7.0.9466.1
and the Nuget package has 17.0.31314.256
.
I think it is preferable to use the Nuget source & ensuring we distribute its dependencies rather than just referencing some DLL which happens to be on my system. But I don't really understand what the difference is between them (if anything).
None of the links provided by the stdole package have been useful. They are:
From Nuget within VS: https://aka.ms/vsextensibility (which redirects to a "Visual Studio SDK" page that isn't obviously relevant & seems not to mention stdole)
From Nuget website the Release Notes link goes to "Visual Studio 2015 Update 2 Release Notes", also seemingly irrelevant
So those seem to be dead ends.
Misc / background info
The app does indeed require stdole
because it interfaces with some legacy VB6 code and a StdPicture
object has to be exchanged.
This question came up because my app had the following error on one PC in particular:
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.
This error has not occurred anywhere else. Because of this I am concerned that we are leaving out a dependency that should be installed, maybe something that by luck exists on most PCs, but not all.