#PowerShell native host with *dynamic* access to Microsoft.PowerShell.SDK from an existing PowerShell installation: success! đŸ„ł

This is *not* using the nuget package, or separate .NET runtime. This loads PowerShell 7 on disk to host it inside a C program! @Steve_MSFT @rjmholt
The trick was to build a managed DLL that references Microsoft.PowerShell.SDK to then expose PowerShell Create/AddScript/Invoke custom delegates to be called from C. I first load the pwsh.dll runtime config, then my NativeHost.dll wrapper inside that context, and it works! 😎
@SeeminglyScienc while this works, it still needs an additional managed DLL for the bindings. Do you have an idea if it would be possible to load this additional assembly *in memory* instead of using a file? I could easily embed it as a resource, it would be the cherry 🍒 on top
You can follow @awakecoding.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.