I've created .net program using dotnet new console -o MyApp -f net6.0
command just as documented in https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/create
I've modified the file:
Program.cs
global using System.Windows.Forms;
System.Console.WriteLine("Primary screen resolution: " + SystemInformation.PrimaryMonitorSize);
System.Console.WriteLine("Virtual size: " + SystemInformation.VirtualScreen);
System.Console.WriteLine("Monitors count: " + SystemInformation.MonitorCount);
But when I run PS C:\Users\box\Desktop\dotnet\MyApp> dotnet run
I get error - how to fix it?
C:\Users\box\Desktop\dotnet\MyApp\Program.cs(1,29): error CS0234: The type or namespace name 'Form
s' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) [C:\U
sers\box\Desktop\dotnet\MyApp\MyApp.csproj]
The build failed. Fix the build errors and run again.
I write program in Notepad.exe - do I need special program to run it? I am using in my program https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.systeminformation?view=windowsdesktop-6.0 and it mentions:
"Namespace: System.Windows.Forms"
"Assembly: System.Windows.Forms.dll"
Somehow my program is missing reference to this I suppose but how to do it?