c# – 自dll更新后VS无法打开控件

前端之家收集整理的这篇文章主要介绍了c# – 自dll更新后VS无法打开控件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我看过很多地方,包括谷歌和SO,但我没有找到任何相关的答案.

我最近在我的应用程序中做了一些更改,包括更新ZedGraph dll(从5.1.4.26270到5.1.6.405),因此,VS不会打开我的控件抛出此错误

Could not load file or assembly ‘ZedGraph,Version=5.1.4.26270,Culture=neutral,PublicKeyToken=…’ or one of its dependencies. The system cannot find the file specified.

哪个指向旧版本.我到处看,我没有找到任何这个旧版本的痕迹.

它也抛出这个错误

The variable ‘lineGraphControl1’ is either undeclared or was never assigned.

而我调用构造函数

this.lineGraphControl1 = new Sakura.UI.Graphing.LineGraphControl();

我试着:

>重新启动
>清洁和Rebluid
>以管理员模式启动VS.
>删除参考并重新添加

没有成功.

如何擦除旧ZedGraph lib的跟踪以及如何修复此错误

编辑

这是旧版本和新版本(旧版本)之间的变化

<Reference Include="ZedGraph,PublicKeyToken=02a83cbd123fcd60,processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\Lib\ZedGraph.dll</HintPath>
</Reference>
<Reference Include="ZedGraph,Version=5.1.6.405,processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\Lib\ZedGraph.dll</HintPath>
</Reference>

编辑2

清除VS的缓存并重新启动计算机后,错误消息已更改:

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
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)

我搞不清楚了.

编辑3

我在整个磁盘中搜索字符串5.1.4.26270,找到的唯一地方不在项目中.

csproj片段:

<Reference Include="ZedGraph,processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\Lib\ZedGraph.dll</HintPath>
</Reference>

编辑4:

(Hans Passant之后)

这是LineGraphControl声明:

public class LineGraphControl : GraphControl<Sakura.Graphing.LineGraph>

LineGraph(使用ZedGraph对象)

public class LineGraph : Graph,ISerializable

图表:

[XmlInclude(typeof(StackedGraph))]
[XmlInclude(typeof(LineGraph))]
[XmlInclude(typeof(BubbleGraph))]
[XmlInclude(typeof(BatchGraph))]
[Serializable]
public abstract class Graph : ISerializable

不幸的是,ZedGraph lib与软件有很深的联系,可以将它改为另一个.

我不会回滚这些更改,因为我以一种使我的软件绘图速度提高250%的方式调整库.

这是在VS中打开LineGraphControl的试验性的callstack:

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
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)

Here’s the activity log

我尝试创建一个新的LineGraphControl时出现错误消息:

ProcMon提取物:

解决方法

问题

错误是找不到的文件,like the one I helped out with the other day

Could not load file or assembly .. The system cannot find the file specified.

故障排除

打开ProcessMonitor并在VS不允许您打开控件并抛出错误时运行它.在失败时停止跟踪并调查ProcMon的(Filemon)日志以查看IDE在哪里查找它找不到的DLL.

将DLL放在预期找到的位置(这有望排除VS库引用失败).

进程监视器帮助在Resharper插件目录中发现了ZedGraph.dll的奇怪引用.我按照这个步骤:

>禁用Resharper>重启VS>清洁&重建>再次启用Resharper>微笑

原文链接:https://www.f2er.com/csharp/244802.html

猜你在找的C#相关文章