vme*_*eln 0 c# powershell azure-service-fabric
我有以下代码Deploy-FabricApplication.ps1从桌面应用程序运行powershell脚本(Service Fabric项目模板附带的标准):
using (var shell = PowerShell.Create())
{
Environment.CurrentDirectory = tmpPath;
var deploymentScriptPath = Path.Combine(tmpPath, "Scripts", "Deploy-FabricApplication.ps1");
var command = new Command(deploymentScriptPath);
shell.AddScript("Import-Module ServiceFabric");
command.Parameters.Add("PublishProfileFile", Path.Combine(tmpPath, "PublishProfiles\\Local.5Node.xml"));
command.Parameters.Add("ApplicationPackagePath", Path.Combine(tmpPath, "pkg\\Release"));
shell.Commands.AddCommand(command);
shell.Invoke();
}
Run Code Online (Sandbox Code Playgroud)
但是shell在脚本调用后包含错误:
[System.Fabric.FabricObjectClosedException]还有另一个错误,但它们是因为ServiceFabric未加载模块而导致的.但是,即使没有RemoteSigned执行策略的管理员权限,此脚本也会从powershell窗口成功运行.那么有没有办法从C#运行这个脚本,所有模块都加载在Poweshell ISE中?
| 归档时间: |
|
| 查看次数: |
543 次 |
| 最近记录: |