Visual Studio 2013设计人员尝试加载错误版本的项目DLL [英] Visual Studio 2013 designer trying to load wrong version of project DLL

查看:180
本文介绍了Visual Studio 2013设计人员尝试加载错误版本的项目DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a visual studio project in a solution that references a class library project from the same solution. The project compiles and executes just fine. However, when I try to open one form in the designer I get a message:

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

Could not load file or assembly 'MyLibName, Version=1.0.5477.26907, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

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

However, the current version of the DLL is: 1.0.5510.41110

为什么设计师试图看为旧版本?我如何在设计师中打开我的表单?

Why is the designer trying to look for an old version? How can I open my form in the designer?

我尝试从在项目中引用它并重新添加的所有项目中删除此库。当然,我从零开始就尝试清理和重建项目。任何帮助赞赏。

I've tried removing this library from all the projects that reference it in my project and re-adding it. And, of course, I've tried cleaning and rebuilding the project from scratch. Any help appreciated.

这是堆栈跟踪:

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) 


推荐答案

最后得到它 - 似乎我不小心将用户控件的公共属性中的旧版本的对象的实例化序列化在此表单上。

Finally got it--seems I'd accidentally serialized an instantiation of an object from the older library version in a user control's public property on this form.

要解决问题:

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

1) I manually edited the .resx file in notepad and removed the base64 encoded binary data for the accidentally serialized property.

2)我按照,您可以在此设置生成代码以供公众使用的公共属性,以防止我的财产在将来被序列化,即。我添加了这个属性:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

2) I followed the directions here to prevent my property from being serialized in the future, ie. I added this attribute: [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

这篇关于Visual Studio 2013设计人员尝试加载错误版本的项目DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆