2
votes

I have an ASP.NET Core RC2 project hosted with Git in Visual Studio Team Services.

When I try build using the Visual Studio Build task in Build vNext I get the following error "The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk."

I can build locally using VS2015 with the .Net Core SDK RC2.

Is there a way to get Asp.Net core RC2 SDK on to the hosted agent - I dont really want to create a custom one.

Anyone know when the .Net Core RC2 SDK will be added the build agent or where to even look for that information.

Thanks.

2
Please use the proper tags in future! When your quesiton is related to ASP.NET Core use "asp.net-core" tag ! NOT "asp.net" and "core", both are completely unrelated to your question. Please read the tag descriptions before adding themTseng

2 Answers

1
votes

Unfortunately you'll have to create your own private agent with Visual Studio 2015 Update 2 and the latest dotnet tools. The team consider .NET Core 1 RC2 as pre-release software, and don't as a rule install pre-release software on the hosted agent image.

0
votes

You can add a PowerShell script task in your build definition to install the required runtime for Asp.Net Core project.

# 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 }

Refer to this link for details: Build and Deploy your ASP.NET 5 Application to an Azure Web App