我在尝试构建项目时遇到 Gitlab 管道问题。我使用 .Net Framework 4.6.2 作为主项目,使用 .Net Core 3.1 进行测试。从 gitlab-runner 文件夹中删除现有项目后发生了这个问题。运行程序在 Windows 机器上。这是错误:
D:\runner\builds\dVdVYxXC\0\semansys\web\project\ProcessFlowModuleDotNetV1\ProcessFlowModuleDotNetV1.csproj(1731,3): error MSB4019: 导入的项目“C:\Program Files\dotnet\sdk\5.0. 102\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets”未找到。确认导入声明“C:\Program Files\dotnet\sdk\5.0.102\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets”中的表达式正确,并且该文件存在于磁盘上。
Ok 不存在于磁盘上,但以前从未存在过。仅当我尝试推送新分支时才会发生这种情况,但当我运行旧管道时没有问题。
stages:
- build
- test
- documentation
before_script:
- Set-Variable -Name "time" -Value (Get-Date -Format "%H:%m")
- echo ${time}
- echo "started by ${GITLAB_USER_NAME}"
build:
stage: build
only:
- branches
script:
- echo "running scripts in the build job"
- choco feature enable -n=allowGlobalConfirmation
- choco install netfx-4.6.2-devpack
- choco install dotnetcore-sdk
- nuget restore -ConfigFile .\nuget.config
- msbuild ".\ProcessFlowModuleDotNetV1\ProcessFlowModuleDotNetV1.csproj" /p:DeployOnBuild=true /p:PublishProfile="Local Publish" /p:WarningLevel=0
- dotnet build ".\ProcessFlowModuleDotNetV1.Tests\ProcessFlowModuleDotNetV1.Tests.csproj" --configuration Release
artifacts:
paths:
- Publish
- .\ProcessFlowModuleDotNetV1.Tests\bin\Release\netcoreapp3.1\**
expire_in: 1 day
after_script:
- Remove-Item -Recurse -Force .\packages\
test:
stage: test
only:
- branches
script:
- New-Item -Name "TestResults" -ItemType "directory" -Force
- '& "$env:VS_TEST" ".\ProcessFlowModuleDotNetV1.Tests\bin\Release\netcoreapp3.1\ProcessFlowModuleDotNetV1.Tests.dll" /InIsolation /logger:"html;logfilename=ProcessFlowModuleDotNetV1.Tests.Results.html" /logger:"trx;logfilename=trx.trx"'
- ./getcoverage.ps1
artifacts:
paths:
- TestResults\**
expire_in: 1 week
when: always
dependencies:
- build
timeout: 5h
after_script:
- taskkill /im chromedriver.exe /f