1
votes

I am developing my first ASP.NET 5 Application and I have some problems with hosted build on Visual Studio Team Services (was Visual Studio Online). I get the error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(126,5): Error : The Dnx Runtime package needs to be installed.

One row before I see following Build message: Cannot find DNX runtime dnx-clr-win-x86.1.0.0-beta8 in the folder: C:\Users\buildguest.dnx\runtimes

I found the solution with Prebuild-Powershell script (https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5)

Note: I added the ASP.Net 5 MVC Project to an existing solution. I have no global.json file and src folder! This is the reason why I have adapted the script as follows:

& iex((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))
$dnxVersion = "latest"
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
Get-ChildItem -Path $PSScriptRoot\..\InternalWeb.Client -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

The script runs after Build step "Get sources" and has following output:

enter image description here

But, I get still the same error message! What's wrong? Thanks for help! Michael

1

1 Answers

1
votes

I ran into the same problem and I found a solution that worked for me. The PowerShell script installs the latest runtime or the one that you have specified in your global.json file. Since it did not work without a global.json file and the default settings, I added a global.json file to my project folder and specified the version that I am using:

{
    "sdk": {
        "version": "1.0.0-rc1-update1",
        "runtime": "coreclr",
        "architecture": "x86"
    }
}

The first try failed again with the following error:

The expected lock file doesn't exist. Please run "dnu restore" to generate a new lock file.

So I added dnu restore to the end of the PowerShell script. The next build was successful. May be this works for you too.