1
现在,PowerShell是open sourced和Linux上可用,任何人都知道如何在Linux下添加.Net程序集?如果可能的话?Linux上的PowerShell - 如何加载使用.Net程序集?
我已经在Ubuntu 16.04上安装了PS,如here,并安装了Mono,如here。
终端上运行PS后,该行出人意料地工作得很好:
add-type -assembly "/usr/lib/mono/4.5-api/System.Web.Extensions.dll"
没有错误等等
然而,当我尝试:
$js = New-Object "System.Web.Script.Serialization.JavaScriptSerializer"
我得到此错误:
new-object : Cannot find type [System.Web.Script.Serialization.JavaScriptSerializer]: verify that the
assembly containing this type is loaded.
At line:1 char:10
+ $ps_js = new-object "System.Web.Script.Serialization.JavaScriptSerial ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
那个提示? 这是一个错误,因为在Linux上的PowerShell仍然是“阿尔法”?
BTW - 在Windows上的所有工作就好了... ...
Miguel de Icaza证实它不适用于Mono,因此您现在只能使用.NET Core运行它。 –
是否提及该确认? –