我尝试在部署后操作中调用带有数组参数的 powerShell 脚本,但没有成功。
这是脚本:
param(
[string[]]$ModelNameList = "DefaultModelName"
)
Write-Host "Number of Models is: $($ModelNameList.Count)"
这是部署后的命令行:
%windir%\sysnative\windowspowershell\v1.0\powershell -File "$(ProjectDir)Scripts\Post_Deployment\Script.Post-Deployment.ps1" -ModelNameList "m2","m1"
结果:模型数量为:1
在 SharePoint2010 命令行管理程序中运行相同的脚本会返回正确的结果。
结果:模型数量为:2