VS2022 Designer not working with inherited .Net 6.0 Form

Toby Chamberlain 21 Reputation points
2022-11-17T01:40:30.987+00:00

Is there anything special I need to do in .Net 6.0 to allow VS2022 to display a C# Form that inherits from a class in a DLL?

I have an existing suite of C# applications/libraries in .Net Framework that I'm looking to convert to .Net 6 (and from 32-bit to 64-bit at the same time). I've got all the libraries compiled and working with .Net6 but when I try to create a new Form using the .Net 6 version of the DLL the VS2022 Designer just shows an error "The Designer could not be shown for this file because none of the classes within it can be designed". The program runs under debug in VS2022 and as a stand-alone .exe when published, so I'm positive everything is setup correctly reference/platform-wise, I just can't edit the Form in VS2022's Designer.

The identical code works when both the Project and referenced DLL are .Net Framework 4.72 (32-bit), it's only when I create it as a .Net 6.0 project that the Designer won't display. I've tried building the DLL as x86, x64 and Any CPU but it always gives the same error when I try to edit the Form.

Is there some extra step required to have VS2022's Designer work with .Net 6.0 DLLs?

Possibly related I can't get the Toolbox to display the .Net6.0 DLL's custom controls either - it works immediately with the .Net Framework DLL.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,962 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,729 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,163 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 31,801 Reputation points Microsoft Vendor
    2022-11-17T06:14:05.14+00:00

    Hi @Toby Chamberlain ,
    It might be a bug and is under Investigation.
    Please check the following thread.
    https://developercommunity.visualstudio.com/t/1740-NET6-WinForms-designer-regress/10198799

    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.