运行 VSO 版本上的 DNU 恢复

Running DNU Restore on VSO build

我正在尝试在 VSO 的主机代理上构建 DNX 项目。

首先是安装 DNX。我有以下 powershell 脚本来执行此操作:

dnx-升级。ps1:

dnvm upgrade -r clr -arch x86 -v 1.0.0-beta6

安装成功并更新 PATH:

Adding C:\Users\buildguest.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin to process PATH
Adding C:\Users\buildguest.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta6\bin to user PATH

然后我需要用这个脚本恢复解决方案的包:

dnu-restore.ps1:

dnu restore

但是在执行 dnu-restore 时出现以下错误。ps1:

[error]dnu : The term 'dnu' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
[error]spelling of the name, or if a path was included, verify that the path is correct and try again.
[error]At C:\aac4a4f6\Root\MyProject\Development\dnu-restore.ps1:1 char:1
[error]+ dnu restore
[error]+ ~~~
[error] + CategoryInfo : ObjectNotFound: (dnu:String) [], CommandNotFoundException
[error] + FullyQualifiedErrorId : CommandNotFoundException

构建任务:

为什么会这样?当然 dnu 应该执行?有没有更好的办法恢复DNX工程包?

使用 this MSDN article 中的 Prebuild.ps1 脚本解决了问题。

正如Victor所说,可能是因为步骤运行在不同的流程中。