Ruben Obregon
Ruben Obregon

Reputation: 21

Team Foundation Server - Local Service Account missing dnx - builds fail? How to fix

Trying to build a simple web project (MVC 5) that runs fine from Visual Studio 2015, but fails when I build it from team foundation server 2015 using TFSBUILD (not using xaml) ...both vs and tfs are on the same machine, Windows 2012 Enterprise, VS 2015, using the local service account for TF.

It seems the local service account is missing the dnx resources so fails - and when I try to add them via a script (see answer below for the script) it gets further in the process but blows up.

UPDATE: Seems like it can't find the global.json file so is using the latest version (update2).

WARNING: Unable to locate global.json to determine using 'latest' Determining latest version 'dnx-clr-win-x86.1.0.0-rc1-update2' is already installed in C:\Windows\ServiceProfiles\LocalService.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2.

But it subsequently bombs because it's actually looking for update1

Cannot find DNX runtime dnx-clr-win-x86.1.0.0-rc1-update1 in the folder: C:\Windows\ServiceProfiles\LocalService.dnx\runtimes

I have changed the build configuration settings, replaced any reference of update1 to update2 in all files, and still it wants update1.

So my question is, what do I have to do to either 1. reconfigure TFS, or 2. Get the resources into the path of the local system account.

During the build I get the following:


GetRuntimeToolingPathTarget: Cannot find DNX runtime dnx-clr-win-x86.1.0.0-rc1-update1 in the folder: C:\Windows\ServiceProfiles\LocalService.dnx\runtime

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

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(126,5): error : The Dnx Runtime package needs to be installed. See output window for more details. [C:\TfsData\Agents\Agent-DESKTOP-U7761A8_work\2\s\MvcMovie\src\MvcMovie\MvcMovie.xproj]


Basically it's complaining it cant find the dnx libraries in the folder C:\Windows\ServiceProfiles\LocalService.dnx\runtime . The local service profile does not have the libraries installed in C:\Windows\ServiceProfiles\LocalService.dnx\runtime.

I can install these libraries from the command line, but it only sticks those in my local user account, even with -global etc..And that the build in TFS still fails.

Results of DMVM LIST:

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-rc1-update1 clr     x64          win
       1.0.0-rc1-update1 clr     x86          win
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win
  *    1.0.0-rc1-update2 clr     x86          win             default
       1.0.0-rc1-update2 coreclr x64          win
       1.0.0-rc1-update2 coreclr x86          win

I used a powershell script that installed the libraries into the local service account folders, and after that the build go further but then bombed out - seemed there were library conflicts:

2016-04-06T23:04:56.0966631Z Building WebApplication4 for DNX,Version=v4.5.1 2016-04-06T23:04:56.5039430Z Using Project dependency WebApplication4 1.0.0 2016-04-06T23:04:56.5039430Z Source: C:\TfsData\Agents\Agent-DESKTOP-U7761A8_work\3\s\WebApplication4\src\WebApplication4\project.json 2016-04-06T23:04:56.5039430Z Unable to resolve dependency EntityFramework.Commands 7.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency EntityFramework.MicrosoftSqlServer 7.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.ApplicationInsights.AspNet 1.0.0-rc1 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Authentication.Cookies 1.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Diagnostics.Entity 7.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Identity.EntityFramework 3.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.IISPlatformHandler 1.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Mvc 6.0.0-rc1-final 2016-04-06T23:04:56.5039430Z
Unable to resolve dependency Microsoft.AspNet.Mvc.TagHelpers 6.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Server.Kestrel 1.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.StaticFiles 1.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.AspNet.Tooling.Razor 1.0.0-rc1-final 2016-04-06T23:04:56.5039430Z Unable to resolve dependency Microsoft.Extensions.CodeGenerators.Mvc 1.0.0-rc1-final 2016-04-06T23:04:56.5498358Z Unable to resolve dependency Microsoft.Extensions.Configuration.FileProviderExtensions 1.0.0-rc1-final 2016-04-06T23:04:56.5654146Z Unable to resolve dependency Microsoft.Extensions.Configuration.Json 1.0.0-rc1-final 2016-04-06T23:04:56.5654146Z Unable to resolve dependency Microsoft.Extensions.Configuration.UserSecrets 1.0.0-rc1-final 2016-04-06T23:04:56.5966887Z Unable to resolve dependency Microsoft.Extensions.Logging 1.0.0-rc1-final 2016-04-06T23:04:56.5966887Z Unable to resolve dependency Microsoft.Extensions.Logging.Console 1.0.0-rc1-final 2016-04-06T23:04:56.5966887Z Unable to resolve dependency Microsoft.Extensions.Logging.Debug 1.0.0-rc1-final 2016-04-06T23:04:56.6122983Z Unable to resolve dependency Microsoft.VisualStudio.Web.BrowserLink.Loader 14.0.0-rc1-final 2016-04-06T23:04:56.6122983Z Using Assembly dependency fx/mscorlib 4.0.0 2016-04-06T23:04:56.6122983Z Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\mscorlib.dll 2016-04-06T23:04:56.6122983Z Using Assembly dependency fx/System 4.0.0 2016-04-06T23:04:56.6122983Z Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\System.dll 2016-04-06T23:04:56.6122983Z Using Assembly dependency fx/System.Core 4.0.0 2016-04-06T23:04:56.6122983Z Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\System.Core.dll 2016-04-06T23:04:56.6122983Z Using Assembly dependency fx/Microsoft.CSharp 4.0.0 2016-04-06T23:04:56.6122983Z
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Microsoft.CSharp.dll 2016-04-06T23:04:56.8622811Z

[error]C:\TfsData\Agents\Agent-DESKTOP-U7761A8_work\3\s\WebApplication4\src\WebApplication4\project.lock.json(1,0):

Error NU1009: The expected lock file doesn't exist. Please run "dnu restore" to generate a new lock file. 2016-04-06T23:04:56.8622811Z

Upvotes: 0

Views: 186

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29958

For your question:

1. Reconfigure TFS

You can configure your build service to run with the account that dnx has been installed. I assume you are using XAML build system, you can change it from here: enter image description here

2. Get the resources into the path of the local system account.

According to the error message you get after installing dnx into local service account, the dun packages weren't restored before build. So you need to add some code in your powershell script to perform a dun restore for "project.json" file to restore the dun packages.

Following is a powershell sample provided by Microsoft to install dnx runtime and restore dun packages:

# bootstrap DNVM into this session.
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}

# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

if($globalJson)
{
    $dnxVersion = $globalJson.sdk.version
}
else
{
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
}

# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

Upvotes: 0

Related Questions