Search This Blog

August 11, 2008

VSTS 2008 could not load file or assembly Interop.SHDocVw

Today I downloaded WatiN (Web application test in .Net) tools and wanted to run the web test using Visual Studio .Net 2008. I got the following error:

Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

If you see this in the future, it is easy to fix it. You can just go to C:\Windows\System32 and copy shdocvw.dll to the bin directory of your current project.

Open your Visual Studio project, add shdocvw.dll in your references and run the test again. The problem will be disappeared.

4 comments:

Anonymous said...

nice

stocks said...

This doesnt work if you have a different version of the DLL.... I am running Windows 7 and when I do what you suggest that error goes away but the new one is:

11/22/2009 7:22:15 PM: Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor(String url)
at XXXXX.XXXXX.RunTask() in C:\Users\XXXXX\Documents\Visual Studio 2008\Projects\Programming Projects\XXXXX\XXXXX\XXXXX.cs:line 21
at Scheduler.Task.Run() in C:\Users\XXXXX\Documents\Visual Studio 2008\Projects\Programming Projects\Scheduler\Scheduler\Task.cs:line 26
at Scheduler.SchedulerItem.Run() in C:\Users\XXXXX\Documents\Visual Studio 2008\Projects\Programming Projects\Scheduler\Scheduler\SchedulerItem.cs:line 60

Ray said...

Jeremy,
What's your scenario and what's your version?

I don't know if WatiN supports Windows 7. :)

Oscar Garcia @ozkary said...

You need the interop file. Look for Interop.SHDocVw.dll in the lib folder that comes with the samples.

full path
WatiN-2.0.20.1089-net-2.0\Examples\MsHtmlBrowser\lib