WatiN 错误无法加载程序集
我收到以下 WatiN 错误:
未处理的异常:System.IO.FileLoadException:无法加载文件 或汇编'Interop.SHDocVw,版本= 1.1.0.0,文化=中性, PublicKeyToken=db7cfd3acb5 ad44e' 或其依赖项之一。这 找到的程序集的清单定义与程序集不匹配 参考。 (HRESULT 异常:0x80131040) 文件名: 'Interop.SHDocVw,版本=1.1.0.0,文化=中性,PublicKeyToken=db
我将 shDocvw.dll 从 System32 复制到 bin 目录,但它仍然给我带来同样的问题。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您已在 VS2010 中使用 NuGet 安装并引用了 WatiN,则您应该已经拥有正确的引用,因此不需要删除并重新添加它们。但您仍然需要在 Interop.SHDocVw 参考上将“嵌入互操作类型”设置更改为 False。
If you've installed and referenced WatiN using NuGet in VS2010, you should already have the correct references, so they don't need to be removed and re-added. But you will still need to change the "Embed Interop Types" setting to False on the Interop.SHDocVw reference.
更新:这个答案是在 Nuget 发布之前编写的,仅适用于您不使用 Nuget 来管理依赖项的情况。如果您使用 Nuget,请参阅 @Nick Jones 的答案,
我今天刚刚遇到了这个问题。您需要下载最新版本的 WatiN(我使用的是 2.0.10.928)并引用 WatiN 提供的已签名的 Interop.SHDocVw.dll。
请尝试以下操作:
希望这有帮助。
更新:尼克·琼斯是正确的。如果您使用 NuGet,这应该不是问题......但我在使用 MvcContrib.Mvc3.TestHelper-ci 时也收到此消息。乍一看似乎“-ci”包是可行的方法,但我决定使用 MvcContrib.WatiN 包有两个原因。
1)我没有收到“无法加载文件或程序集”错误消息
2)MvcContrib.Mvc3.TestHelper-ci 是 使用旧版本 WatiN.Core.dll (1.3.0.4000),而 MvcContrib.WatiN 包使用较新版本 (2.0.0.99)
UPDATE: This answer was written before Nuget was released and applies only if you are NOT using Nuget to manage your dependencies. If you are using Nuget see the answer by @Nick Jones
I just had this issue today. You need to download the latest version of WatiN (I'm using 2.0.10.928) and reference the signed Interop.SHDocVw.dll that is provided by WatiN.
Try the follwoing:
Hope this helps.
UPDATE: Nick Jones is correct. This should not be an issue if you are using NuGet....but I was also getting this message when using MvcContrib.Mvc3.TestHelper-ci. At first glance it seems like the '-ci' packages is the way to go but I decided to use the MvcContrib.WatiN package for two reasons.
1) I don't get the "Could not load file or assembly" error message
2) The MvcContrib.Mvc3.TestHelper-ci is using an old version of WatiN.Core.dll (1.3.0.4000) where as the MvcContrib.WatiN package is using a newer version (2.0.0.99)
查看参考“Interop.SHDocVw.dll”的属性。将“嵌入互操作类型”更改为 False。
问题是它没有复制 bin 文件夹中的 dll 文件。但经过这样的设置后,它就会正确执行。
我有同样的错误,现在工作正常。
Check out the Properties of the Reference "Interop.SHDocVw.dll". Change the "Embed Interop Types" to False.
The problem is that it is not copying the dll file in your bin folder. But after this setting, it will do it properly.
I had the same error, and now its working fine.