'dotnet restore' vs. 'nuget restore' with TeamCity

后端 未结 3 1611
感情败类
感情败类 2020-12-08 00:16

I have an ASP.NET Core project that builds properly with Visual Studio, but it doesn\'t build under MSBuild.

It doesn\'t find all the common libraries (system, etc.)

3条回答
  •  有刺的猬
    2020-12-08 01:06

    I had similar problems with a .NET Core 2 project that would build just fine on my workstation - both within Visual Studio 2017 and using MSBuild only - but did not build in TeamCity. The error message was:

    C:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(327, 5):
    Assets file 'D:\TeamCity\buildAgent\work\596486b1d4e7a8e7\Source\Integrations\SomeAPI\obj\project.assets.json' not found.
    Run a NuGet package restore to generate this file.
    

    In my build configuration I already had a NuGet install step before the build step:

    • NuGetversion: 3.4.4
    • Restore Mode: Install

    It turned out I had to use:

    • NuGet version: 4.0.0 or higher
    • Restore Mode: Restore (Requires NuGet 2.7+)

提交回复
热议问题