Cannot use System.Windows.Forms in preview7
See original GitHub issueCannot use System.Windows.Forms in 3.0-preview7
When upgrading from 3.0 preview6 to 3.0-preview7 I get stuck with:
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
General
I realised that the error was coming from the version of dotnet Core after uninstalling ALL available SDKs but the 3.0-preview6 version. I then executed dotnet --version and realised it was still using 3.0-preview7 which made no sense.
This makes me think the uninstaller must also be broken.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Can't use System.Windows.Forms
Right-click your project in Solution Explorer and select Add reference... and then find System.Windows.Forms and add it. ... OK, I am having this ......
Read more >System.Windows.Forms Namespace
In this article Contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the ......
Read more >Why does it fail to use "System.Windows.Forms" namespace?
To do that go to the Solution Explorer and right click on the project and click on Add Reference and then select System.Windows.Forms....
Read more >How can I use Windows Form in a dotnet core Fsharp script?
One thing you could try is to run fsi.exe with the --langversion:preview switch, add a #r "nuget: System.Windows.Forms" to the top of your ......
Read more >System.Windows.Forms not available in Visual Studio ...
I have Visual Studio for Mac Preview. Net Core 3.0 preview 6. System.Windows.Forms is not available. I cannot even get it from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Your project was targeting WPF stack. To target WinForms (or more officially Windows Forms) you need to use
<UseWindowsForms>true</UseWindowsForms>as @weltkante suggested.AFAIK you can target both stacks simultaneously too, e.g. use both switches:
Do you have a
<UseWindowsForms>true</UseWindowsForms>in the project file?