【问题标题】:Gitlab ci build failed to restore packages for asp.net core projectGitlab ci build 无法恢复 asp.net 核心项目的包
【发布时间】:2018-09-17 20:13:33
【问题描述】:

我试图配置一个简单的管道来构建我的 asp.net 核心应用程序并将其部署到共享主机中,但是它总是无法恢复 Newtonsoft.Json,争议该项目是可构建的并且完全可以在本地机器上运行,我的ci 文件如下所示:

image: microsoft/dotnet:latest

stages:
  - build

before_script:
  - dotnet restore -s https://api.nuget.org/v3/index.json --packages ./.nuget/

build:
  stage: build
  script:
    - "dotnet build"

我在管道中遇到的错误是:

/usr/share/dotnet/sdk/2.1.402/Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

我也只尝试了 dotnet restore,但结果相同。

【问题讨论】:

    标签: asp.net-core continuous-integration devops gitlab-ci gitlab-ci-runner


    【解决方案1】:

    我发现了问题,我添加了 Newtonsoft.Json 作为参考,而不是从 nuget 安装它(实际上是 Visual Studio 从快速操作中为我添加了它作为参考),所以我删除了参考并将其安装为包和一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-28
      • 1970-01-01
      • 2018-05-29
      相关资源
      最近更新 更多