Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Could not load file or assembly Interop.SHDocVw
 

Could not load file or assembly Interop.SHDocVw

I get the below error when loading the windows form designer in Visual Studio 2005. It only happens on forms that include an undocked MS word preview section.

It worked fine when I had the project in VS2003.

Has anyone had this problem before? Does anyone know how to fix it

Cheers

Paul.

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)
Hide

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name, Boolean throwOnError)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetAssembly(AssemblyName name)
at Microsoft.VisualStudio.Design.VSDynamicTypeService.OnAssemblyResolve(Object sender, ResolveEventArgs e)
at System.AppDomain.OnAssemblyResolveEvent(String assemblyFullName)
at AxSHDocVw.AxWebBrowser.AttachInterfaces()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.set_Site(ISite value)
at System.ComponentModel.Container.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)

PaulTheSoftwareDeveloper  Tuesday, January 24, 2006 11:22 PM

I found out what is causing the error.

It is because there is a different wrapper around DLLs in VS2005, so what you need to do to fix it is remove all references from your project of AxInterop.ShDocVw.dll, and Interop.ShDocvw.dll. Then you need to go into your project's bin directory and delete the Interop.ShDocvw.dll and AxInterop.ShDocVw.dll.

Then go into the windows/system32 directory and copy the ShDocVw.dll into your project's bin directory.

Then, in your project, add a reference to this. It will put a new wrapper around it which is compatable with VS2005.

Then close all forms you have open in your project, rebuild your project, and it should work fine.

PaulTheSoftwareDeveloper  Friday, February 17, 2006 1:16 AM

Oh, and I forgot to say, you also need go go into your windows form designer generated code and replace a few lines of code to reference the correct classes of the new assemblies.

They should all be shown as warnings, so just go through them all, delete the old line, and use the VS2005 intellisense (and error correction suggestions) to find the correct assembly classto use.

Then, you should be able to say cool bananas.

PaulTheSoftwareDeveloper  Friday, February 17, 2006 2:05 AM

I'm getting a similar error on the Interop.SHDocVw assembly - I'm using the band object project for the IE toolbar and this worked well in VS 2003. After upgrade to VS 2005 I get the error.

Tony

Tony Long  Tuesday, February 07, 2006 4:48 AM

I found out what is causing the error.

It is because there is a different wrapper around DLLs in VS2005, so what you need to do to fix it is remove all references from your project of AxInterop.ShDocVw.dll, and Interop.ShDocvw.dll. Then you need to go into your project's bin directory and delete the Interop.ShDocvw.dll and AxInterop.ShDocVw.dll.

Then go into the windows/system32 directory and copy the ShDocVw.dll into your project's bin directory.

Then, in your project, add a reference to this. It will put a new wrapper around it which is compatable with VS2005.

Then close all forms you have open in your project, rebuild your project, and it should work fine.

PaulTheSoftwareDeveloper  Friday, February 17, 2006 1:16 AM

Oh, and I forgot to say, you also need go go into your windows form designer generated code and replace a few lines of code to reference the correct classes of the new assemblies.

They should all be shown as warnings, so just go through them all, delete the old line, and use the VS2005 intellisense (and error correction suggestions) to find the correct assembly classto use.

Then, you should be able to say cool bananas.

PaulTheSoftwareDeveloper  Friday, February 17, 2006 2:05 AM

hi,

i did as you told.but i got the error "the dll donot have the strong name".then using tlbimp command i convert it into dotnet assembly.but still the view of the toolbar is not coming.but it is not showing error when i build the project.i pasted the error code also.

Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e202f0c2eaf9625d' or one of its dependencies. The system cannot find the file specified.
Hide

at System.Signature._GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)
at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandle fieldHandle, RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Signature..ctor(RuntimeFieldHandle fieldHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Reflection.RtFieldInfo.get_FieldType()
at System.ComponentModel.Design.InheritanceService.AddInheritedComponents(Type type, IComponent component, IContainer container)
at System.Windows.Forms.Design.DocumentDesigner.Initialize(IComponent component)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

santhoshbharadwaj  Tuesday, March 14, 2006 6:25 AM

Thats just a "Could not find the file" error.

You should check to make sure you copied the dll files into the correct directory, and that all the old references have been replaced by the new ones.

It can be a bit of a tedious task, but you need to be meticulous and make sure that there are none of the references to the old DLLs left..

PaulTheSoftwareDeveloper  Monday, March 20, 2006 9:11 PM

Above solutions did not worked for me. I found correct solution.

Delete allshdocvw.dll references from your project.Instead of adding reference to shdocvw.dll, add control for Microsoft Web Browser control in toolbar of Visual Studio 2005. Itcan be found on COM Components tab of Choose Toolbox Items. After that create a temporary form and drag this control on that form. It will automatically add reference to AxWebBrowser.dll interop assembly.Remove temporary form for your project.Close all forms andrebuild your solution.

Shabdar  Wednesday, April 05, 2006 2:15 PM
I fix this problem by replacing solution directory to another folder.
Artyom  Monday, April 10, 2006 11:00 AM

I was getting this error from a thrid party COM control I was using. It appears that if I had the form containing the control open when I closed VS 2005, when I reopened the project it would have a problem finding the .DLL.

I've avoided the problem by closing the "offending" form before I close VS 2005. Opening it once VS 2005 has completed loading the project works just fine.

Carl

carl lorentson  Thursday, December 21, 2006 8:58 PM
I don't fix because vs 2008 want to copy this file on current project directory
Please help me!
wwwlancer  Friday, March 27, 2009 4:09 PM

You can use google to search for other answers

Custom Search

More Threads

• IE7 tab component
• Custom Control inherited from GroupBox
• Possible Bug in VS 2008
• Can an ExtenderProvider expose Public Events as well
• Error-Bug BindingSource in Designer :DataSource gives System.OutOfMemoryException
• Groupbox...missing properties (text foreground & text justification)
• Disable design time support for child controls
• Add custom button to a form caption
• CodeDom passing an enum to a method invoke
• FormDesigner not available for usercontrol and should be.