microsoft / winforms-designer-extensibility

MIT License
56 stars 13 forks source link

System.IO.FileNotFoundException : 'Could not load file or assembly 'Microsoft.DotNet.DesignTools.Server' throws when initializing the designer in the control constructor. #40

Open BagavathiBasker opened 3 months ago

BagavathiBasker commented 3 months ago

We are facing System.IO.FileNotFoundException : 'Could not load file or assembly 'Microsoft.DotNet.DesignTools.Server' when initializing the designer in the control constructor. This issue occurs only after installation of the Microsoft.WinForms.Designer.SDK.

CustomControl (2).zip

.Net Version: .Net60

CodeSnippets:

public CustomButton() { InitializeComponent();

IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
CustomButtonDesigner designer = designerHost.GetDesigner(this) as CustomButtonDesigner;
//if (designer.check)
//{

//}

}

Exception details:

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'Microsoft.DotNet.DesignTools.Server, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Source=CustomControl StackTrace: at CustomControl.CustomButton..ctor() in C:\Users\BagavathiPerumalApra\Downloads\CustomControl\CustomButton.cs:line 40 at CustomControl.Form1.InitializeComponent() in C:\Users\BagavathiPerumalApra\Downloads\CustomControl\Form1.Designer.cs:line 31 at CustomControl.Form1..ctor() in C:\Users\BagavathiPerumalApra\Downloads\CustomControl\Form1.cs:line 7 at CustomControl.Program.Main() in C:\Users\BagavathiPerumalApra\Downloads\CustomControl\Program.cs:line 14