Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a side note, you can literally write a C# program and run it inside PowerShell without installing the normal .NET toolchain. Add-Type can accept a string with C# source code and it'll build on-the-fly and load it into your PowerShell environment. And from the C# code you can P/Invoke C functions if you need.

Once you've loaded it up, you can use it directly from PowerShell. I've done this in a pinch and then wrapped it up in a normal PowerShell cmdlet to do things that weren't available from PowerShell otherwise and without needing a .NET build workflow, without needing to store .DLLs, etc. In OP's situation that's what I'd be doing instead of building .DLLs.

https://learn.microsoft.com/en-us/powershell/module/microsof...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: