winformsvisual-studio-2022windows-forms-designer.net-8.0

Visual Studio 2022 v17.11 to v17.12 Upgrade - Form Designer Issues


We have a very large WinForms solution (38 projects) that targets .NET 8.0 (Windows), and it worked just fine in VS 17.11.6 but as soon as we upgraded to v17.12 we can no longer open most Forms/Controls in the out-of-process form designer. (Multiple users)

We can compile the entire solution and run the application just fine.

We are able to open Forms/Controls that derive directly from Form or UserControl, but any that derive from subclasses of Form/UserControl fail with either the "The designer could not be shown for this file because none of the classes within it can be designed" or "Could not load file or assembly 'WinRT.Runtime, Version=2.1.0.0..." (we're not targeting WinRT.)

I did some digging and found that a new WinForms project targeting .NET 8.0 (Windows) worked just fine with the Form Designer. I compared project files and found that is I removed the OS versioning from the target platform, ex. "net8.0-windows" instead of "net8.0-windows10.0.22621.0" I could then open the Form Designer.

After further trial and error, I found that if the project targeted windows 7 or 8, the designer would work fine, but anything newer and it would fail.

Has anyone else run into this? And is there a way to fix it? Currently, I'm rolling back to VS 17.11.6

Any help appreciated.


Solution

  • After some more experimentation I found that the issue was caused when updating to Visual Studio 2022 v17.11.6, but the release window was so short between that and v17.12 that I likely never tried to edit a Form/Control in the designer, so assumed it was v17.12 that caused it.

    As we don't have a good reason to target a specific version of Windows, we have decided to alter the TargetFramework to be "net8.0-windows" for all our projects and that does seem to resolve the issue we are having with the Forms Designer.

    However, I'm sure there are plenty of people out there with good reasons to be targeting a specific version that may also run afoul of this issue, so hopefully Microsoft will address it in an upcoming release.