Could not load file or assembly 'xxxx' or

2019-02-12 16:22发布

问题:

Inside VS2005, our whole programming staff gets this error message sporadically and it is always on the BeneControls project. This error message happens multiple times a day and it occurs when going into DESIGN mode for a control. Normally rebuilding the BeneControls fixes the problem but somtime the whole solution has to be rebuilt.

Has anyone else solved this problem yet?

Any recommendations or web sites that outlines what needs to be done?

Sometimes I just wish MS would add a rebuild button to the error message screen.

We are using Visual Studio 2005, VB.NET and DevExpress Controls.

Here is the whole error message:


One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.

Could not load file or assembly 'BeneControls, Version=1.0.3289.23008, Culture=neutral, PublicKeyToken=null' 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 System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

Thanks in advance, Gerhard

回答1:

Version=1.0.3289.23008 - that tells me you version number is constantly changing, have you thought about fixing on a version number during development?

On AssemblyInfo.vb:

Currently it is set to increment:

[assembly: AssemblyVersion("1.0.*.*")]

Change to:

[assembly: AssemblyVersion("1.0.0.0")]

And you have it in a fixed version.



回答2:

Well, I am not a developer but I got to deploy a project which actually send fax using the fax services on windows 2008 server 64bit. the project was developed on a windows 32bit platform and I was setting all the information according to the given instruction but still I this annoying error and then I found the solution and that was to change the platform from anycpu to x86 and it worked. for a complete setting list please follow the link below: http://www.sizledcore.com/2011/10/could-not-load-file-or-assembly/



回答3:

I've seen this in the past in a situation where the control was in the same assembly as the consumer - the GAC and versioning didn't help there -- it seems to be related to the way that the designer locks the assembly in memory, and refuses to budge.

The advice our developers have is to not leave form designers open when closing VS, or switching between build types (I think it's due to the sharing the same output folder between build configurations in VB.Net)