WatiN 错误无法加载程序集

发布于 2024-08-05 14:04:51 字数 358 浏览 7 评论 0 原文

我收到以下 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 目录,但它仍然给我带来同样的问题。

I am getting the following WatiN error:

Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembl y 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=db7cfd3acb5 ad44e' or one of its dependencies. The
located assembly's manifest definition do es not match the assembly
reference. (Exception from HRESULT: 0x80131040) File name:
'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db

I copied the shDocvw.dll from System32 to the bin directory but still it is giving me the same problems.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

就此别过 2024-08-12 14:04:51

如果您已在 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.

梦旅人picnic 2024-08-12 14:04:51

更新:这个答案是在 Nuget 发布之前编写的,仅适用于您不使用 Nuget 来管理依赖项的情况。如果您使用 Nuget,请参阅 @Nick Jones 的答案,

我今天刚刚遇到了这个问题。您需要下载最新版本的 WatiN(我使用的是 2.0.10.928)并引用 WatiN 提供的已签名的 Interop.SHDocVw.dll。

请尝试以下操作:

  1. 删除对 Interop.SHDocVw.dll 的所有其他引用
  2. 右键单击​​您的解决方案并选择“清理解决方案”
  3. 引用 WatiN 提供的 Interop.SHDocVw.dll
  4. 构建您的解决方案。

希望这有帮助。

更新:尼克·琼斯是正确的。如果您使用 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:

  1. Remove all other References to Interop.SHDocVw.dll
  2. Right Click your solution and select 'Clean Solution'
  3. Reference the Interop.SHDocVw.dll that is provided by WatiN
  4. Build your solution.

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)

晌融 2024-08-12 14:04:51

查看参考“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文