Running a PowerShell script in Mono? [duplicate]

2019-08-20 08:35发布

问题:

Possible Duplicate:
Do PowerShell scripts run under Mono?

Alright, I've been tasked with getting PowerShell scripts to run on a CentOS 5.7 box using the PowerShell automation libraries with .NET. This means I have to run this on Mono, but I'm getting a slew of errors about missing references. Here is the tutorial I am using: http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C

The Mono project compatibility page (http://www.mono-project.com/Compatibility) doesn't say whether it supports Powershell or not. I find it hard to believe that a project like Mono would not have these important libraries.

回答1:

No, PowerShell is not something that Mono supports right now. Porting an entire framework (legally) is a lot of work.

Frankly I don't think there is a huge demand for PowerShell on Mono since *nix environments typically already have a rich scripting environment, which is what PowerShell is trying to bring to Windows.



回答2:

If your script only uses 1.0 features and using mono is not a hard requirement, then powershell v1.0 runs fine under WINE according to winehq.

http://appdb.winehq.org/objectManager.php?sClass=application&iId=8049