[Hello World] run c# from powershell

How to run csharp code from command line with powershell. One line PS> add-type ‘public class c{public const string s=”hello world”;}’;[c]::s hello world You can also execute visual basic directly from powershell. PS> Add-Type -language visualbasic ‘public class v >> public const s as string = “Hello World” >> end class’ >> PS> [v]::s Hello… Continue reading [Hello World] run c# from powershell

Create helloworld.exe file in powershell

PS> Add-Type -outputtype consoleapplication -outputassembly helloworld.exe ‘public class helloworld{public static void Main(){System.Console.WriteLine(“hello world”);}}’ PS> .\helloworld.exe hello world Probably my first .exe this century 🙂