These just became a lot easier with the nuget package System.Management.Automation.
When powershell first arrived you could download a small sdk that just allowed the development of cmdlets.
Over time this got folded into the windows sdk so that you had in install 6GB of files just to get the required assemblies.
Now we have a nuget package and can again write Powershell Cmdlets in C#.