X-Sharp / XSharpPublic

Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
Apache License 2.0
113 stars 38 forks source link

Controls in NuGet packages are not loaded in the WinForms designer #1126

Open tortagel opened 2 years ago

tortagel commented 2 years ago

The WinForms designer does not load controls from NuGet packages, e.g.: Microsoft.Web.WebView2.

When you open the Toolbox window in an X# project, no WebView2 control appears: x#

When you open the Toolbox window in a C# project, the WebView2 control appears: c#

I've created two minimalistic examples to reproduce the issue, adding only the NuGet package:

If I add manually the reference to the WebView2 dll, then the control appears and can be used in the designer, but this generates a version mismatch warning. After removing the reference again (keeping only the NuGet package), the designer no longer works because of the unknown WebView2 control type. However, at runtime everything works fine, so it really seems to be only a designer issue.

RobertvanderHulst commented 2 years ago

I need to run this through the debugger, but I suspect that the Form designer asks the project system which references it has. Apparently the C# project system includes the DLL names of the files from the Nuget packages, and we don't. That should not be too difficult to implement. Unfortunately this subsystem in VS is NOT documented, so we have to use trial and error (and de-compiling of their code) to figure out how this works.