sharpdevelop 加载设计器失败

sharpdevelop Failed to load designer

我正在使用 Sharpdevelop 5.1.0.5134.NET 4.5.51209 基于Windows.Forms

制作桌面应用

起初,一切都很好,没有警告,设计器正确显示了表单,我可以轻松添加组件。

之后,我从 Package Management Console 中正确添加了 OxyPlot,然后我找到了新的 PlotView Custom Comonents 选项卡中的组件。

问题是我无法从工具选项卡将组件添加到表单,所以我通过在源文件中编写等效语句来做到这一点。

构建过程很顺利,应用程序也运行良好,但现在我在设计器选项卡中看不到表单,而是收到了这条消息:

Failed to load designer. Check the source code for syntax errors and check if all references are available.

ICSharpCode.FormsDesigner.FormsDesignerLoadException: System.ComponentModel.Design.Serialization.CodeDomSerializerException: Could not find type 'OxyPlot.WindowsForms.PlotView'.  Please make sure that the assembly that contains this type is referenced.  If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.

System.ComponentModel.Design.Serialization.CodeDomSerializerException: The variable 'plot1' is either undeclared or was never assigned.
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadDesigner()
   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadAndDisplayDesigner()
   at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadInternal(OpenedFile file, Stream stream)
   at ICSharpCode.SharpDevelop.Workbench.AbstractViewContentHandlingLoadErrors.Load(OpenedFile file, Stream stream)

我该如何解决这个问题?

这似乎是 SharpDevelop 5.1 中的一个错误,无法解析 OxyPlot 程序集。

SharpDevelop 4.4好像没有同样的问题,可以在设计器中打开窗体

作为 SharpDevelop 5.1 的解决方法,您可以将 OxyPlot.dll 和 OxyPlot.WindowsForms.dll 文件复制到 C:\Program Files (x86)\SharpDevelop.1\bin

然后重启SharpDevelop就可以在设计器中打开窗体了,没有任何错误。

此错误应在 SharpDevelop 5.1.0.5173 及更高版本中修复。