I am trying to open IE Explorer from my windows forms application. I have method A which makes call to another method B, which uses SHDocVw to open the browser. The place where i get this error is When i try to call the method B from method A, the call is not even transferred to B even when a break point is set. This is the exception thrown "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". But the same code works fine in other windows forms applications. I am using VS 2008 . The reference to SHDOCVW is added from C:\Windows\System32 .
private void Form1_Load(object sender, EventArgs e)
{
OpenBrowser();
}
private static void OpenBrowser()
{
MyClass.CallBrowser();
}
public static class MyClass
{
public static void CallBrowser()
{
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp)ie;
wb.Visible = true;
object o = null;
wb.Navigate("www.google.com", ref o, ref o, ref o, ref o);
}
}