How do I load System.Threading.Thread Assembly from GAC using partial name?

Occasional Contributor

I tried everything, but I'm not able to get `[System.Threading.Thread]::CurrentThread`. I tried `Add-Type` and `[System.Reflection.Assembly]::Load(...)`, but to no avail.


I do not want to use the workaround of writing a C# string and have that be compiled by `Add-Type`, I just want to add the assembly to my app domain to work with it.


As I want it to run everywhere, I don't want to use the fully qualified assembly name. The partial name must suffice, so my script will be able to run everywhere (.NET Standard 1.0).


Can someone please point me to the right solution? How can I load `System.Threading.Thread` into my PowerShell app domain, so I can finally use `CurrentThread`?


Examples for both, Windows PowerShell and PowerShell Core, would be very appreciated.

0 Replies