我搜索了与此问题相关的所有主题,但没有找到解决问题的方法。我正在尝试使用GitLab在QA环境中以发布模式运行dotnet publish,但出现错误'指定的deps.json [C:\ GitLab-Runner \ builds \ 7d2c6d1d \ 0 \ projectPath \ bin \ Debug \ netcoreapp2.1 \ projectName.deps.json]不存在'。在Debug配置中一切正常。
下面是我所有使用的设置(文件的某些名称可能会更改)。
异常日志:
$ cd DataProjectPath
$ dotnet ef database update -v --no-build -s "..\WebApiProjectPath"
Using project 'C:\GitLab-Runner\builds\7d2c6d1d\0\DataProjectPath\DataProj.csproj'.
Using startup project '..\WebApiProjectPath\WebApiProjectPath.csproj'.
Writing 'C:\GitLab-Runner\builds\7d2c6d1d\0\DataProjectPath\obj\DataProj.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\jenksvnuser\AppData\Local\Temp\tmpFCA1.tmp /verbosity:quiet /nologo C:\GitLab-Runner\builds\7d2c6d1d\0\DataProjectPath\DataProj.csproj
Writing '..\WebApiProjectPath\obj\WebApiProjectPath.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\jenksvnuser\AppData\Local\Temp\tmpFF61.tmp /verbosity:quiet /nologo ..\WebApiProjectPath\WebApiProjectPath.csproj
dotnet exec --depsfile C:\GitLab-Runner\builds\7d2c6d1d\0\WebApiProjectPath\bin\Debug\netcoreapp2.1\WebApiProjectPath.deps.json --additionalprobingpath C:\Users\jenksvnuser\.nuget\packages --additionalprobingpath
"C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --fx-version 2.1 "C:\Program Files\dotnet\sdk\2.1.403\DotnetTools\dotnet-ef\2.1.4\tools\netcoreapp2.1\any\tools\netcoreapp2.0\any\ef.dll" database update --assembly
C:\GitLab-Runner\builds\7d2c6d1d\0\WebApiProjectPath\bin\Debug\netcoreapp2.1\DataProj.dll --startup-assembly C:\GitLab-Runner\builds\7d2c6d1d\0\WebApiProjectPath\bin\Debug\netcoreapp2.1\WebApiProjectPath.dll --project-dir
C:\GitLab-Runner\builds\7d2c6d1d\0\DataProjectPath\ --language C# --working-dir C:\GitLab-Runner\builds\7d2c6d1d\0\DataProjectPath --verbose --root-namespace DataProj
The specified deps.json [C:\GitLab-Runner\builds\7d2c6d1d\0\WebApiProjectPath\bin\Debug\netcoreapp2.1\WebApiProjectPath.deps.json] does not exist
ERROR: Job failed: exit status 2147516545`
Gitlab CI / CD配置:
stages:
- unit_test
- build_deploy
unit_test:
stage: unit_test
script:
- 'cd ProjectName'
- 'dotnet test ProjectName.Common.Tests'
- 'dotnet test ProjectName.Data.Tests'
- 'dotnet test ProjectName.Repository.Tests'
- 'dotnet test ProjectName.Service.Tests'
- 'dotnet test ProjectName.WebApi.Tests'
# THIS DEPLOY WORKS IF CHANGED FROM RELEASE TO DEBUG
deploy_qa:
stage: build_deploy
script:
- 'cd ProjectName'
- 'SET ASPNETCORE_ENVIRONMENT=QA'
- 'dotnet publish --configuration Release --output C:\QA\core-web-api-build'
- 'if exist \\server\c$\Apps\QA\core-web-api\ del /q \\server\c$\Apps\QA\core-web-api\*'
- '(robocopy C:\QA\core-web-api-build\ \\server\c$\Apps\QA\core-web-api /E) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0'
- 'cd ProjectName.Data'
- 'dotnet ef database update -v --no-build "..\ProjectName.WebApi"'
- 'cd C:\QA\core-web-api-build'
- 'dotnet ProjectName.MasterData.dll QA'
environment:
name: server
url: http://adress:91
when: manual
#only:
#- QA
致谢。