我想在 V2 C# Azure Function App 中运行 PowerShell 命令。我尝试从 Visual Studio 中的 .NET Core 2.1 项目运行 PowerShell Core(据我所知,这是我使用 .NET Core 访问 PS 的唯一方法),但使用 C# 时效果很好。 Azure Function App(使用 .NET Core)项目当我尝试访问 URL 时收到以下错误:
Executed 'Function1' (Failed, Id=dbb00673-938b-4d50-9576-9b3a4ec06c06) [2018-11-05 09:51:17] System.Private.CoreLib: Exception while executing function: Function1. AmberTest: Could not load file or assembly 'System.Management.Automation, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.
Run Code Online (Sandbox Code Playgroud)
我安装了以下 NuGet 软件包(适用于 PowerShell Core):