Search code examples
asp.net-coretfsbuildazure-devopsdnx.net-4.6

Running DNU Restore on VSO build


I am trying to get DNX projects building on VSO's host agent.

First thing is installing DNX. I have the following powershell script to do this:

dnx-upgrade.ps1:

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

It successfully installs and PATH is updated:

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

Then I need to restore the solution's packages with this script:

dnu-restore.ps1:

dnu restore

But I get the following error when executing 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:\a\8ac4a4f6\Root\MyProject\Development\dnu-restore.ps1:1 char:1
[error]+ dnu restore
[error]+ ~~~
[error] + CategoryInfo : ObjectNotFound: (dnu:String) [], CommandNotFoundException
[error] + FullyQualifiedErrorId : CommandNotFoundException

Build tasks:

Build tasks

Why is this happening? Surely dnu should execute? Is there a better way to restore DNX project packages?


Solution

  • Using the Prebuild.ps1 script from this MSDN article solved the problem.

    As Victor suggested, it may be because the steps are run in different processes.