Change Sytem
to System
.
Powershell The type or namespace name 'Sytem' could not be found (are you m issing a using directive or an assembly reference?)
Hello
i tried using System.Windows.Forms; in my code but it show me an error.
What is wrong, because i want to create the form application using my namespace.
Is it possible to do?
Thanks for help.
$code = @"
using System;
using System.Windows.Forms;
namespace HelloWorld
{
public class Program
{
public static void Main(){
Console.WriteLine("Hello world!");
}
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
iex "[HelloWorld.Program]::Main()"
-
Sam of Simple Samples 5,551 Reputation points
28 June 2021, 4:52 pm
1 additional answer
Sort by: Most helpful
-
MotoX80 35,626 Reputation points
28 June 2021, 7:33 pm Why are you trying to write C# code inside of Powershell? Download the free Visual Studio Community edition and use it to build GUI C# apps. It will be so much easier to develop and test.