6

We're just in the process of transitioning from VS2013&15/TFS2013 to VS2017/TFS2017 (on-site TFS, not VSTS) and the first test solution is a dotNet Core 1.1 based one (a multi-project web service).

The solution builds fine on the original developer's box and I've got it out of TFS and it builds fine on mine too. In keeping with our previous methodology the contents of the packages folder are checked in with the projects as this makes the packages locally available on the build box (no internet).

Building the solution on the build server is a different story, however, as I get multiple errors of the form...

..\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.

I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.

This whole project.assets.json not found issue seems to be causing headaches all over. In my case the issue is that I'm trying to resolve it on our TFS 2017 Build Server, which does not and never will have internet access ('cos it's a server!).

All the solutions I've seen thus far seem to suggest running the Nuget Restore command but that can't work since the server cannot get to nuget.

This is nothing fancy yet, just a simple TFS 2017 Build definition with a Get sources and a Build solution step. I can't understand how something so simple has become so difficult.

Changing the Nuget Package Restore options makes no difference.

Since the project.assets.json files are generated on the fly in the obj folder, I can't even check them in to reuse. Can anyone please suggest a workaround, at the moment the test project is dead in the water.

Edit: trying the same process with a 4.6.1 web project created with VS2015 had similar results of unresolved references (e.g. System.Web) but didn't raise the same error, probably due to being an older, non-Core project.

Mike
  • 2,120
  • 1
  • 23
  • 40
  • What's the detail version of your Nuget version on the build agent? Are you trying to restore a local Nuget feeds? – PatrickLu-MSFT Feb 02 '18 at 09:47
  • 2
    nuget on the server is 3.3.0 - installed by VS2017 as part of its install process, the box is a fresh VM. Not trying to use local feeds, tried but it didn't seem to make any difference. God, this is stupidly difficult. – Mike Feb 07 '18 at 06:50
  • Sorry about this and thanks for the sharing info, an environment without internet and as a build agent actually is not a common situation, you may have to pay more attention to make it work properly. – PatrickLu-MSFT Feb 07 '18 at 07:40
  • 1
    I beg to differ on the environment, given the number of posts I have read over the last two weeks regarding the lack of a proper offline installer for VS2017. My own experience is that all the build servers I've ever dealt with have been locked down like vaults specifically for the purpose of ensuring a totally controlled build environment. Perhaps all the others haven't got to the build server problems yet because of the installation problems(!) - we had a an enterprise ticket open with MS for almost two weeks just to deal with the installation of VS2017. Not good. – Mike Feb 08 '18 at 10:31

1 Answers1

3

According to I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.

The issue seems not related to TFS build side since it also not work with local build through VS in the build agent machine.

Since this is a dotnet project. So, you could try to use “dotnet restore” and not “nuget restore”. Try using the dotnet core template (which uses dotnet restore).

If you are using authenticated nuget feeds, then you can use nuget restore but you also need to use nuget installer task. See https://github.com/Microsoft/vsts-tasks/issues/3762 for a discussion on that. The Nuget version should be higher than 4.0.

Without dotnet restore and Nuget restore and only use get source/Visual Studio Build will not be able to build the dotnet core project. If your server do not have internet access, as a workaround you should use Local feeds.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks for that, I'll have a read and give those a go on Monday. Much appreciated, I'll let you know how I get on. – Mike Feb 03 '18 at 09:44
  • Thank you so much for the information, the "dotnet restore" finally enabled the project to build on the build server without internet, I'll convert the template over and should be able to finally put this to rest. Thanks again. – Mike Feb 05 '18 at 06:57
  • 1
    So I switched the template to the "ASP.NET Core (.NET Framework)" template and continue to get the error so I'm going to try switching to local feeds, I really can't see any other way round this. It's a real pain though as it means we end up having to replicate a portion of nuget locally and maintain it, which seems to make a mockery of the entire idea of a centralised package repository. – Mike Feb 06 '18 at 01:08