question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use System.Windows.Forms in preview7

See original GitHub issue

Cannot 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:closed
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RussKiecommented, Jul 29, 2019
<UseWPF>true</UseWPF>

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:

<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
1reaction
weltkantecommented, Jul 29, 2019

Do you have a <UseWindowsForms>true</UseWindowsForms> in the project file?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found