C# stdole.dll 有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/162028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does stdole.dll do?
提问by
We have a large C# (.net 2.0) app which uses our own C++ COM component and a 3rd party fingerprint scanner library also accessed via COM. We ran into an issue where in production some events from the fingerprint library do not get fired into the C# app, although events from our own C++ COM component fired and were received just fine.
我们有一个大型 C# (.net 2.0) 应用程序,它使用我们自己的 C++ COM 组件和一个也可以通过 COM 访问的第 3 方指纹扫描仪库。我们遇到了一个问题,即在生产中,来自指纹库的某些事件没有被触发到 C# 应用程序中,尽管来自我们自己的 C++ COM 组件的事件被触发并被很好地接收。
Using MSINFO32 to compare the loaded modules on a working system to those on a failing system we determined that this was caused by STDOLE.DLL not being in the GAC and hence not loaded into the faulty process.
使用 MSINFO32 将工作系统上加载的模块与故障系统上的加载模块进行比较,我们确定这是由于 STDOLE.DLL 不在 GAC 中导致的,因此未加载到故障进程中。
Dragging this file into the GAC caused events to come back fine from the fingerprint COM library.
将此文件拖入 GAC 会导致事件从指纹 COM 库中正常返回。
So what does stdole.dll do? It's 16k in size so it can't be much... is it some sort of link to another library like STDOLE32? How come its absence causes such odd behavior?
那么stdole.dll 有什么作用呢?它的大小为 16k,所以它不能太多......它是指向另一个库(如 STDOLE32)的某种链接吗?为什么它的缺失会导致这种奇怪的行为?
How do we distribute stdole.dll? This is an XCOPY deploy app and we don't use the GAC. Should we package it as a resource and use the System.EnterpriseServices.Internal.Publish.GacInstall to ensure it's in the GAC?
我们如何分发stdole.dll?这是一个 XCOPY 部署应用程序,我们不使用 GAC。我们是否应该将其打包为资源并使用 System.EnterpriseServices.Internal.Publish.GacInstall 来确保它在 GAC 中?
回答by artur02
It seems that stdole.dll is a primary interop assembly. See Office 2003 Primary Interop Assemblies on MSDN.
似乎 stdole.dll 是主要的互操作程序集。请参阅MSDN 上的 Office 2003 主要互操作程序集。
回答by Mike
I had to also add a reference to my project for stdole. Even though I don't have any references to it (it's a simple image app), 2 of our users were getting errors that it was missing. It could be that they were only running .net 2.0 when this is a 3.5 app. I have figured out why.
我还必须为 stdole 添加对我的项目的引用。尽管我没有对它进行任何引用(这是一个简单的图像应用程序),但我们的 2 位用户还是收到了缺少它的错误消息。当这是一个 3.5 应用程序时,他们可能只运行 .net 2.0。我已经知道为什么了。
I also went in to publish on the project properties tab, and selected Application Files, then included the stdole to be deployed. Hopefully that will work.
我还进入在项目属性选项卡上发布,并选择应用程序文件,然后包含要部署的 stdole。希望这会奏效。
回答by Simon
I had the same problem. I just deleted the reference from the application and recompiled. Ran all the tests which passed. Then redeployed without the dll and it all worked.
我有同样的问题。我刚刚从应用程序中删除了引用并重新编译。运行所有通过的测试。然后在没有 dll 的情况下重新部署,一切正常。
I dont know how a reference to this got in the project in the first place. It is a legacy app so must have been a long time ago.
我不知道这个项目的引用是如何首先出现在项目中的。这是一个遗留应用程序,所以一定是很久以前的了。
Simon
西蒙
回答by DimDim
In our project IDispatch couses using stdole.dll. We've change it to object and remove IDispatch, then remove stdole from references.
在我们的项目 IDispatch 中使用 stdole.dll。我们已将其更改为 object 并删除 IDispatch,然后从引用中删除 stdole。
回答by Tony L.
This issue is also discussed over here: Why is Visual Studio 2015 adding stdole.dll and Microsoft.AnalysisServices.AdomdClient.dll to my project?
这个问题也在这里讨论:为什么 Visual Studio 2015 将 stdole.dll 和 Microsoft.AnalysisServices.AdomdClient.dll 添加到我的项目?
Upgrading an older project to VS 2015 is what caused stdole.dll to start getting included in the project in this case.
在这种情况下,将旧项目升级到 VS 2015 是导致 stdole.dll 开始包含在项目中的原因。
If the library referencing has the option to "Embed Interop Types" in the properies, this is preferred and the stdole.dll may not be needed after that. Just set Embed Interop Types=true
in the properties of the reference.
如果库引用具有在属性中“嵌入互操作类型”的选项,则这是首选,之后可能不需要 stdole.dll。只需Embed Interop Types=true
在引用的属性中设置即可。
Libraries that allow this include the MS Office libraries such as Office, Excel, Core. An example of one that does not is Crystal Reports.
允许这样做的库包括 MS Office 库,例如 Office、Excel、Core。一个没有的例子是 Crystal Reports。
Hans Passantstrongly discouragessetting Embed Interop Types=false
here: What's the difference setting Embed Interop Types true and false in Visual Studio?
Hans Passant强烈反对Embed Interop Types=false
在此处进行设置:Visual Studio 中将嵌入互操作类型设置为 true 和 false 有什么区别?
回答by Ruskin
In my case, it was an old unused reference to Office Word Interop ... but removing that was not sufficient: The publish profile still had line to copy stdole.dll !
在我的例子中,它是对 Office Word Interop 的一个旧的未使用的引用......但删除它是不够的:发布配置文件仍然有行复制 stdole.dll !
<File Include="bin/stdole.dll"> ...
Deleting that line (found using 'Find in Files') and deleting the stdole.dll from the bin folder on the remote server fixed my problem.
删除该行(使用“在文件中查找”找到)并从远程服务器上的 bin 文件夹中删除 stdole.dll 解决了我的问题。
Hope this helps someone else.
希望这对其他人有帮助。