WatiN System.IO.FileNotFoundException Interop.SHDo

2019-01-22 10:54发布

I have just started to receive the following error when running my WatIn tests.

System.IO.FileNotFoundException : Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. The system cannot find the file specified.

I have searched the web and tried the following solutions, none of which work.

Can anyone assist?

标签: .net nunit watin
7条回答
神经病院院长
2楼-- · 2019-01-22 11:40

I always end up recompiling watin so it isn't signed, as I couldn't make any of the suggested solutions work either.

You can get the source here: http://watin.org/

Open the solution in the \source\src folder (there are VS2008 and VS2010 versions), open both projects and go properties -> Signing, uncheck 'sign the assembly', and build the solution.

You should get two DLLs in \source\src\Core\bin (WatiN.Core.dll and Interop.SHDocVw.dll) - just copy these into your project and they should work Ok.

查看更多
走好不送
3楼-- · 2019-01-22 11:40

Have you tried this:

Go to solution explorer, click on the interop dll, in properties change "Embed Interop types" to FALSE.

Best to use NuGet addon for .net studio and then add reference to wattin via "Add Library Package Reference".

查看更多
Melony?
4楼-- · 2019-01-22 11:48

I had this problem and got around it by manually adding the Interop.ShDocVw.dll into the output directory.

查看更多
叼着烟拽天下
5楼-- · 2019-01-22 11:51

In my case, I tried all of the suggested solutions and it did not work. I ended up closing and reopening Visual Studio 2015 with admin privileges, and then the solution compiled successfully.

Hope it helps someone.

查看更多
我只想做你的唯一
6楼-- · 2019-01-22 11:54

You need the Interop.ShDocVw.dll file that should have come with Watin, you might have to add it to your visual studio solution or to the same directory as the Watin dll's if it's not already there. In the case that you do have it make sure that you have the correct version.

查看更多
够拽才男人
7楼-- · 2019-01-22 11:54

If you are using the Visual Studio TestTools you should set the DeploymentAttribute to solve this Problem.

Example:

[DeploymentItem( @"your_path\Interop.SHDocVw.dll" )]
public class WatinTestSuite {

... 

}
查看更多
登录 后发表回答