Roslyn设置 - Powershell脚本

时间:2017-08-20 13:06:23

标签: powershell roslyn executionpolicy

我一直在尝试从Github安装Rosyln源代码并遵循build setup instructions

第一条指令是运行Restore.cmd - 它会产生以下错误消息:

File C:\Code\roslyn-master\build\scripts\build.ps1 cannot be loaded. 
The file C:\Code\roslyn-master\build\scripts\build.ps1 is not digitally signed. 
You cannot run this script on the current system. For more information about 
running scripts and setting execution policy, see about_Execution_Policies 
at
http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo          : SecurityError: (:) [], 
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess

我使用Set-ExecutionPolicy来禁用检查:

PS C:\ Code \ roslyn-master> Get-ExecutionPolicy -List

Scope           ExecutionPolicy
-----           ---------------
MachinePolicy   Undefined
UserPolicy      Undefined
Process         Undefined
CurrentUser     Undefined
LocalMachine    Undefined

但是,我仍然收到同样的错误。我在Windows 10 Pro计算机上运行Visual Studio 2017社区。

提前致谢

吉姆

1 个答案:

答案 0 :(得分:1)

Restore.Cmd文件包含以下命令:

powershell -noprofile -executionPolicy RemoteSigned -file“%~dp0 \ build \ scripts \ build.ps1”-restore%*

我设置Powershell策略并不重要 - 文件将覆盖它。当我删除执行策略子句时,文件运行正常。