Ton*_* L. 29 dll reference visual-studio-2015
在Visual Studio的早期版本中,这些DLL不会添加到我的项目中.我的猜测是我的一个引用对这些DLL有依赖性.根据我的阅读,突出显示的Microsoft.Office.Interop.Excel可能是那个.谁能证实这一点?我还应该注意,即使我将它们从项目中排除,VS 2015也会始终发布这些DLL.如果我删除它们,VS 2015将重新制作它们.
编辑:我已确认Excel和Office引用是导致包含stdole.dll的原因.请参阅下面的选定答案以删除stdole.dll.
我已经删除了自定义引用.如果需要更多信息,请与我们联系.这是我目前的参考资料:
Nic*_*ick 21
正如其他人指出的那样,stdole.dll是一组Office互操作组件的主互操作程序集.您可以通过执行以下操作来确定将其包含在项目中的原因.
在Visual Studio中,转到Tools > Options > Projects and Solutions > Build and Run.将"MSBuild项目构建输出详细程度"设置更改为Detailed.现在清理并重建您的项目.
打开"输出"窗口并搜索stdole.你应该找到这样一个部分:
25> Dependency "stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
25> Resolved file path is "D:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Common\stdole.dll".
25> Reference found at search path location "{Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}".
25> For SearchPath "D:\Git\FoobarServices\Dependencies\Dependencies".
25> Considered "D:\Git\FoobarServices\Dependencies\stdole.winmd", but it didn't exist.
25> Considered "D:\Git\FoobarServices\Dependencies\stdole.dll", but it didn't exist.
25> Considered "D:\Git\FoobarServices\Dependencies\stdole.exe", but it didn't exist.
25> For SearchPath "{CandidateAssemblyFiles}".
25> Considered "Dependencies\CrystalDecisions.CrystalReports.Engine.dll", but its name "CrystalDecisions.CrystalReports.Engine" didn't match.
25> Considered "Dependencies\CrystalDecisions.Enterprise.Framework.dll", but its name "CrystalDecisions.Enterprise.Framework" didn't match.
25> Considered "Dependencies\CrystalDecisions.Enterprise.InfoStore.dll", but its name "CrystalDecisions.Enterprise.InfoStore" didn't match.
25> Considered "Dependencies\CrystalDecisions.ReportSource.dll", but its name "CrystalDecisions.ReportSource" didn't match.
25> Considered "Dependencies\CrystalDecisions.Shared.dll", but its name "CrystalDecisions.Shared" didn't match.
25> Considered "Dependencies\CrystalDecisions.Web.dll", but its name "CrystalDecisions.Web" didn't match.
25> For SearchPath "{TargetFrameworkDirectory}".
25> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\stdole.winmd", but it didn't exist.
25> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\stdole.dll", but it didn't exist.
25> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\stdole.exe", but it didn't exist.
25> For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}".
25> Considered AssemblyFoldersEx locations.
25> Required by "CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL".
25> Required by "CrystalDecisions.ReportSource, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL".
25> Required by "CrystalDecisions.CrystalReports.Engine, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL".
25> Required by "CrystalDecisions.Enterprise.InfoStore, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304".
25> The ImageRuntimeVersion for this reference is "v1.0.3705".
Run Code Online (Sandbox Code Playgroud)
您可以看到Visual Studio搜索程序集的位置以及底部需要它的位置.在我的例子中,它是一堆旧的Crystal Reports程序集.
有时您可以通过Tony建议的依赖关系嵌入互操作类型,但并非总是如此.对我来说,Crystal Reports程序集不支持此功能.
我通过将stdole.dll(32KB,数字签名)C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\复制到我项目中的"Dependencies"文件夹中修复了这个问题(以及提到的阴险的scottsanpedro).我将文件添加到我的项目中并添加了一个显式引用(Add Reference> Browse).最后,我打开了新引用的属性并设置Embed Interop Types为True.
这似乎是一个更好的情况.我不需要担心获得程序集的无符号版本.
Ton*_* L. 13
如果您有选项,请使用Embed Interop Types并将stdole.dll全部保留在一起,否则每次移动未登录stdole.dll的应用程序(新服务器或dev机器)时都会遇到问题.
问题:有一个引用需要stdole.dll,stdole.dll现在被自动推送到bin文件夹.
解:
如何查找引用:当您单击引用的属性时,请检查"嵌入互操作类型"是否设置为false.为了进一步挖掘,尼克的答案有一些很好的信息.
引用我到目前为止已经确认使用stdole.dll(可能还有更多的办公程序)
办公室
高强
核心
Crystal Reports(感谢Lithium.正如Nick指出的那样,你可能没有设置的优势Embed Interop Types=true)
如果您找到更多,请将它们添加到此列表中或在注释中记下它们,我会这样做.
Hans Passant 强烈反对Embed Interop Types=false在此处设置:有什么区别设置在Visual Studio中嵌入Interop类型是真还是假?
Scott Hanselman还谈到了"Embed Interop Types"在这里的作用:http://www.hanselman.com/blog/CLRAndDLRAndBCLOhMyWhirlwindTourAroundNET4AndVisualStudio2010Beta1.aspx
我多年来一直在处理这个问题.
每当我从网络平台或任何更新安装任何东西时,stdole.dll都会被非签名版本替换.我暂时向微软报告了这个漏洞但却被置若罔闻.
我转到C:\ Program Files(x86)\ Microsoft.NET\Primary Interop Assemblies并从此处复制签名版本(22kb)并替换C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Visual Studio中的版本Office\PIA\Common(16kb)工具,解决了这个问题.
斯科特
| 归档时间: |
|
| 查看次数: |
18638 次 |
| 最近记录: |