Paul Cavacas
Paul Cavacas

Reputation: 4454

VSTS setting up CI for ASP.NET Core 2 application

I'm trying to build an ASP.NET Core 2.0 application using Visual Studio Team Services. I have setup a build using the .NET Core tasks (2.* version). Very basic setup just .NET Core Restore, .NET Core Build, .NET Core Test, Publish Test Results, .NET Core Publish and Publish Artifact.

When I start the build it is error on the Restore step. First I get a warning that says

2017-09-20T17:25:02.3384534Z ##[warning]Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
2017-09-20T17:25:02.3384534Z ##[warning]NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_1110.config

Then I get an error that says

error NU1100: Unable to resolve 'Microsoft.Extensions.SecretManager.Tools (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.
error NU1100: Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.
error NU1100: Unable to resolve 'Microsoft.AspNetCore.All (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.

I tried adding a .NET Core Tools Installer step to download version 2.0.0, but continued to get the same error.

I also tried a Nuget Tool Installer to pull in a newer version of nuget that I read somewhere was needed, but that didn't work either.

What do I need to do to Build an ASP.NET Core 2.0 project in VSTS.

Edit I have redone the build with debug = true and also copied the project over to OneDrive both can be found here (https://oceanspray-my.sharepoint.com/personal/pcavacas_oceanspray_com/_layouts/15/guestaccess.aspx?folderid=0dda9fd96603e4eaaa51d605029fa47f1&authkey=Ad36W5fWf0-J7QN6uIPexXg&expiration=2017-09-30T04%3a00%3a00.000Z). At the root of that location is a file Build Log.txt, which contains the log from the Restore section. There is also a folder which contains the whole project.

Upvotes: 0

Views: 319

Answers (1)

Marina Liu
Marina Liu

Reputation: 38116

Hosted VS2017 agent has already installed .net core 2.0, so it’s ok to queue the asp.net core 2.0 project with Hosted VS2017 agent.

Based on your log, it seems it does not specified where to download the packages in your project level nuget.config file. So you can add the content in your nuget.config file:

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />

And specify the path of your nugget.config in .NET Core restore task, then the nugget packages should be restored successful.

Upvotes: 1

Related Questions