You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Visual Studio 2019 Preview 1, there is no project template for generating .NET Core 3 WinForms projects. If I instead run on the command line:
dotnet new winforms -o winforms_core_test
a project is created successfully. I can then open the generated .csproj file in VS2019. But the WinForms designer doesn't seem to be available. Typically the right-click context menu shows "view designer", but it is missing, and shift+f7 after opening the code doesn't work either:
On a standard WinForms project, the Designer.cs file is typically shown as a child of the form source code, and the designer is available on the context menu:
Is there any way to use the designer with .NET Core 3, or is it planned in the future?
Reacted by Daniel Smith, Michael Stramel, Fergal Moran, 霸道卡东东, Jtfs, Joe Esposito, Joe Amenta, Unknown6656, Stefan Steiger, Boris Krit and 4 more
Workaround to use the designer is to create two apps:
.NET Framework app for designing the WinForms app
.NET Core app to run the WinForms application
Both the applications will reference same files.
Steps:
Using developer command prompt, create a .NET Core WinForms app. This app will be used to run the WinForms application. Steps:
Open developer command prompt and run following command:
"C:\Program Files\dotnet\dotnet.exe" new winforms -o <>
From Visual Studio, create a new Windows Forms App (.NET Framework) project. This project will be used to design the WinForms. Steps:
a. Go to File -> New -> Project
b. Select Visual C# -> Windows Forms App (.NET Framework)
c. From solution explorer, select Form1.cs and all the sub files under this node -> right click -> Delete
d. Select project -> right click -> Add Existing Item
e. Browse to the Form1.cs file in the .NET Core WinForms app folder which would have got created in Step 1
f. In the Add Existing Item dialog, select Form1.cs file and change Add to 'Add As Link' option
g. Build the project. There might be a build error to add a using statement for the namespace having Form1. Add that and build the project
h. Run the application and Form1 should show up
i. To display Form1 in designer, right click on Form1.cs -> Open with -> select CSharp Form Editor (Default) -> Ok
Now the Net Framework app can be used to design the WinForms and .NET Core app can be used to run the application.
I am not sure if this will work properly, since the resulting files are not nested/missing the .designer.cs file in the classic framework project. The designer would pick this up all right, but would on CodeDom serialization create InitializeComponent in the main form class, thus projects ending up with two InitializeComponent methods and wouldn't really compile?
(Correct me, if I am missing something here!).
I think what's need to be done here is adding links to all three files, and then nest them in the Classic Framework Project in addition, so changes from the Visual Designer would actually go into the form.designer.cs.
@jnm2 this issue tracks only Winforms while dotnet/project-system#2963 is tracking progress for Winforms and WPF. I don’t think either has to be duped, but feel free to relate the two :)
Failed to load file or assembly "System.ComponentModel.TypeConverter, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a "Or one of its dependencies. The system could not find the specified file.
Reacted by YaR, Antonio Pelleriti, William Kent, Hans Bakker and Thomas Volden
I've figured out how to workaround the assembly-load failure identified by @maikebing. What you need to do is to multitarget your .NET Core (SDK-style csproj) project to multitarget .NET Framework as well as .NET Core, ensuring that the .NET Framework TFM is first in the list. This will cause VS to attempt to resolve the designer types using .NET Framework before it tries (and fails) to do so using .NET Core.
Only problem I have identified is, when I try to debug it, it now debugs only the .NET Framework version. I am not certain how to instruct the VS debugger to target the .NET Core version, while not breaking the designer. In the meanwhile, we can run the .NET Core EXE from the command line and do Debug > Attach to Process.
In short: The Windows Forms designer now works with Visual Studio 2019! 🎉 🎉 🎉
Reacted by Joseph Musser, AraHaan, John and Håkon K. Olafsen
<TargetFrameworks>net48;netcoreapp3.0</TargetFrameworks> didn't work for me but <TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks> works fine for both WinForms and WPF with Visual Studio 16.3.0.
I'm going to close this since we have released a Windows Forms Designer for .NET Core; more information here - https://github.com/dotnet/winforms/tree/master/Documentation/designer-releases.
The current Designer is still in a preview state and supports the basic set of control. The team is working around the clock to bridge the remaining gap.
Also did you submit feedback in Visual Studio when you hit this issue? That's probably going to be more constructive and give the team something actionable.
Reacted by kirsan31, Filip Navara and Joseph Musser
Activity
dotMorten commentedon Dec 4, 2018
That limitation is already documented on the landing page : https://github.com/dotnet/winforms/blob/master/README.md
richlander commentedon Dec 4, 2018
It is also documented in today's blog post: https://blogs.msdn.microsoft.com/dotnet/2018/12/04/announcing-net-core-3-preview-1-and-open-sourcing-windows-desktop-frameworks/
bobasaurus commentedon Dec 4, 2018
Ah, I must have missed that. Thanks, looking forward to future support.
zsd4yr commentedon Dec 4, 2018
Going to keep this issue open so that people can track anything on-going here
[-]VS2019 .Net Core 3 WinForms Designer Support Missing?[/-][+]WinForms Designer Support[/+]Tanya-Solyanik commentedon Dec 4, 2018
Workaround to use the designer is to create two apps:
Both the applications will reference same files.
Steps:
Using developer command prompt, create a .NET Core WinForms app. This app will be used to run the WinForms application. Steps:
Open developer command prompt and run following command:
"C:\Program Files\dotnet\dotnet.exe" new winforms -o <>
From Visual Studio, create a new Windows Forms App (.NET Framework) project. This project will be used to design the WinForms. Steps:

a. Go to File -> New -> Project
b. Select Visual C# -> Windows Forms App (.NET Framework)
c. From solution explorer, select Form1.cs and all the sub files under this node -> right click -> Delete
d. Select project -> right click -> Add Existing Item
e. Browse to the Form1.cs file in the .NET Core WinForms app folder which would have got created in Step 1
f. In the Add Existing Item dialog, select Form1.cs file and change Add to 'Add As Link' option
Now the Net Framework app can be used to design the WinForms and .NET Core app can be used to run the application.
Workaround provided by @Shyam-Gupta
KlausLoeffelmann commentedon Dec 5, 2018
I am not sure if this will work properly, since the resulting files are not nested/missing the .designer.cs file in the classic framework project. The designer would pick this up all right, but would on CodeDom serialization create
InitializeComponentin the main form class, thus projects ending up with twoInitializeComponentmethods and wouldn't really compile?(Correct me, if I am missing something here!).
I think what's need to be done here is adding links to all three files, and then nest them in the Classic Framework Project in addition, so changes from the Visual Designer would actually go into the form.designer.cs.
jnm2 commentedon Dec 6, 2018
Duplicate of dotnet/project-system#2963?
zsd4yr commentedon Dec 6, 2018
@jnm2 this issue tracks only Winforms while dotnet/project-system#2963 is tracking progress for Winforms and WPF. I don’t think either has to be duped, but feel free to relate the two :)
maikebing commentedon Dec 7, 2018
wjk commentedon Jan 26, 2019
I've figured out how to workaround the assembly-load failure identified by @maikebing. What you need to do is to multitarget your .NET Core (SDK-style csproj) project to multitarget .NET Framework as well as .NET Core, ensuring that the .NET Framework TFM is first in the list. This will cause VS to attempt to resolve the designer types using .NET Framework before it tries (and fails) to do so using .NET Core.
Only problem I have identified is, when I try to debug it, it now debugs only the .NET Framework version. I am not certain how to instruct the VS debugger to target the .NET Core version, while not breaking the designer. In the meanwhile, we can run the .NET Core EXE from the command line and do Debug > Attach to Process.
In short: The Windows Forms designer now works with Visual Studio 2019! 🎉 🎉 🎉
39 remaining items
fatihyildizhan commentedon Sep 23, 2019
<TargetFrameworks>net48;netcoreapp3.0</TargetFrameworks>didn't work for me but<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>works fine for both WinForms and WPF with Visual Studio 16.3.0.RussKie commentedon Sep 23, 2019
Do you have .NET 4.8 installed?
merriemcgaw commentedon Sep 24, 2019
And do you have the targeting pack installed for .NET 4.8?
KaneLeung commentedon Sep 25, 2019
netcore 3.0 designer preview

you can use this vsix
RussKie commentedon Sep 25, 2019
I'm going to close this since we have released a Windows Forms Designer for .NET Core; more information here - https://github.com/dotnet/winforms/tree/master/Documentation/designer-releases.
The current Designer is still in a preview state and supports the basic set of control. The team is working around the clock to bridge the remaining gap.
paul1956 commentedon Oct 5, 2019
As far as I can tell these instructions are still needed for VB since the preview does not work.
dotMorten commentedon Oct 20, 2019
@Karaulov
You saw this note right?
Also did you submit feedback in Visual Studio when you hit this issue? That's probably going to be more constructive and give the team something actionable.
fatihyildizhan commentedon Oct 20, 2019
@Karaulov Which version are you using? Did you upgrade to the latest version?