成功还原后,CI脚本找不到NuGet软件包

时间:2019-11-26 10:48:54

标签: c# msbuild continuous-integration nuget gitlab

我一直是实验室的博士生,那里我们的开发人员相对较少。我们已经从整体存储库切换到了多个存储库,这些存储库构建并部署到我们的NuGet存储库(托管在nexus上)。但是,我们的CI脚本无法正常工作,因为NuGet还原在某些配置中失败(我们现在有三种可能性,它们似乎都可以在随机时间运行:调用nuget.exe,使用restore参数调用MsBuild或同时调用两者)。

有人对这个问题有建议吗?几个月来,我们一直在进行修改,但是仍然不一致……非常感谢!

CI脚本如下:

variables:
  PROJECT_NAME: "project"

before_script:
  - echo "starting build for %PROJECT_NAME%"

stages:
  - build
  - test
  - deploy

build:
  stage: build
  tags: [windows,csharp]
  script:
  - echo "Debug build..."
  - echo "Diagnostic:"
  - 'echo %NUGET_SOURCE%'
  - 'echo %MSBUILD_FULL_PATH%'
  - 'c:\nuget\nuget.exe restore -source %NUGET_SOURCE% -recursive'
  - '"%MSBUILD_FULL_PATH%" /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /restore /property:restoresources=%NUGET_SOURCE% /property:Configuration=Debug "project.csproj"'
  artifacts:
    untracked: true

test:
  stage: test
  tags: [windows,csharp]
  script:
  - echo "Testing"
  - '"%MSTEST_FULL_PATH%" .\bin\Debug\net472\TestProject.dll'

deploy:
  stage: deploy
  tags: [windows,csharp]
  script:
  - '"%MSBUILD_FULL_PATH%" /t:pack "hecklib-graphics.csproj"'
  - 'c:\nuget\nuget.exe push bin\debug\*.nupkg %NUGET_API_KEY% -Source %NUGET_TARGET%'

0 个答案:

没有答案