Winforms Can';t加载System.Resources.Extensions-在.Net Framework中

Winforms Can';t加载System.Resources.Extensions-在.Net Framework中,winforms,exception,typeinitializationexception,Winforms,Exception,Typeinitializationexception,我的代码中突然出现了一个错误,这是一个为.NETFramework 4.6.1编译的表单应用程序。当我去创建一个从TreeView对象继承的对象时,就会发生这种情况 它在TreeView上的作用非常小 例外情况是: System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Resources.Extensions, Version=4.0.0.0,

我的代码中突然出现了一个错误,这是一个为.NETFramework 4.6.1编译的表单应用程序。当我去创建一个从TreeView对象继承的对象时,就会发生这种情况

它在TreeView上的作用非常小

例外情况是:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Resources.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>
并在设置中执行以下操作:

private void InitializeComponent()
{
    this.SuspendLayout();
    // 
    // LinkTreeView
    // 
    this.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText;
    this.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.LinkTreeView_DrawNode);
    this.MouseEnter += new System.EventHandler(this.LinkTreeView_MouseEnter);
    this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.LinkTreeView_MouseMove);
    this.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.LinkTreeView_NodeMouseClick);
    this.MouseLeave += new System.EventHandler(this.LinkTreeView_MouseLeave);
    this.ResumeLayout(false);
}
它有成员变量,但它们都是标准表单类:

private Brush disabledBrush;
private Brush foregroundBrush;
private Brush linkBrush;
private Brush visitedBrush;
private Brush backGroundBrush;

private Pen activeLinkPen;
private Pen linkPen;
private Pen visitedLinkPen;

private StringFormat format;

// the delete bitmap out at the end.
private static readonly Bitmap deleteActive;
private static readonly Bitmap deleteDisabled;
private static readonly Rectangle rectDeleteBitmap;

知道出了什么问题吗?

这个项目最初是建立在.Net核心上的吗?还是一个NuGet包裹丢失了?这是一个或多个依赖项之一。如果它是一个NuGet包(对于4.6.1),请重新安装它(我的意思是主包)。它使用的一个库最近也是为.NETCore构建的。但是它仍然在构建.Net Framework版本,这就是我正在使用的-我非常确定(我会再次检查)。在将csproj文件转换为较新的SDK样式时,我遇到了相同的错误。你找到答案了吗?我在发布使用
System.Resources.Extensions
的.NET Framework项目时遇到了类似的问题,在进一步调查后,我注意到DLL从未复制到我的发布文件夹中,并且手动执行此操作修复了错误,但目前这是临时修复
private Brush disabledBrush;
private Brush foregroundBrush;
private Brush linkBrush;
private Brush visitedBrush;
private Brush backGroundBrush;

private Pen activeLinkPen;
private Pen linkPen;
private Pen visitedLinkPen;

private StringFormat format;

// the delete bitmap out at the end.
private static readonly Bitmap deleteActive;
private static readonly Bitmap deleteDisabled;
private static readonly Rectangle rectDeleteBitmap;