【问题标题】:Visual Studio 2013 designer trying to load wrong version of project DLLVisual Studio 2013 设计器试图加载错误版本的项目 DLL
【发布时间】:2015-02-02 07:00:45
【问题描述】:

我的解决方案中有一个 Visual Studio 项目,该项目引用了同一解决方案中的类库项目。该项目编译并执行得很好。但是,当我尝试在设计器中打开一个表单时,我收到一条消息:

无法加载文件或程序集“MyLibName, Version=1.0.5477.26907, Culture=neutral, PublicKeyToken=null”或其依赖项之一。该系统找不到指定的文件。

但是,DLL 的当前版本是:1.0.5510.41110

为什么设计师要寻找旧版本?如何在设计器中打开我的表单?

我已尝试从我的项目中引用它的所有项目中删除此库并重新添加它。而且,当然,我已经尝试从头开始清理和重建项目。任何帮助表示赞赏。

这是堆栈跟踪:

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver)
at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver)
at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData)
at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader) 

【问题讨论】:

  • 也许在工具箱里?
  • 这是一个很好的建议——有问题的项目确实在工具箱中放置了项目。不知道如何让它识别新版本?
  • 试过右键“重置工具箱”没有解决:-(
  • 它可能仍作为项目参考添加到某处。

标签: dll visual-studio-2013 windows-forms-designer


【解决方案1】:

终于明白了——似乎我不小心在此表单上的用户控件的公共属性中序列化了来自旧库版本的对象的实例化。

解决问题:

1) 我在记事本中手动编辑了 .resx 文件,并删除了意外序列化属性的 base64 编码二进制数据。

2) 我遵循了here 的指示,以防止我的财产将来被序列化,即。我添加了这个属性: [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-06
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    相关资源
    最近更新 更多