.net - gitlab ci yaml 为 dontnet 框架和 .net 核心配置
问题描述
我有一个 .net 解决方案,它同时具有.Net 框架和.net 核心项目。在我的 gitlab-ci.yaml 中运行带有图像图像的“dotnet build”时失败: mcr.microsoft.com/dotnet/core/sdk:latest。
错误:/usr/share/dotnet/sdk/3.1.412/Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
。
下面是我的 yaml 脚本,
sonarqube-check:
stage: quality
image: mcr.microsoft.com/dotnet/core/sdk:latest
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
before_script:
- git submodule update --init
script:
- "apt-get update"
- "apt-get install --yes openjdk-11-jre"
- "dotnet tool install --global dotnet-sonarscanner"
- "export PATH=\"$PATH:$HOME/.dotnet/tools\""
- "dotnet sonarscanner begin /k:\"tst_one_app_AXrhff7NXe4Qltg-o5pk\" /d:sonar.login=\"$SONAR_TOKEN\" /d:\"sonar.host.url=$SONAR_HOST_URL\" "
- "dotnet build"
- "dotnet sonarscanner end /d:sonar.login=\"$SONAR_TOKEN\""
allow_failure: true
only:
- merge_requests
- master
- develop
- branches
使用“ dotnet build ”命令,我的解决方案中的所有 .net 核心项目都在构建,但我唯一的 .Net 框架项目因上述错误而失败。
解决方案
推荐阅读
- javascript - 如何将组件挂钩与 Formik handleSubmit 一起使用?
- linux - Ansible 创建用户并将他们分配到基于 vars 的特定组
- apache-kafka-streams - Kafka Stream:应用程序重启时的 Kafka Windowed Stream 行为
- javascript - 调用反应路由器链接时反应引导下拉菜单不会关闭
- google-cloud-platform - 从 GCP 向 Segment.io 发送 HTTP POST 请求
- mongodb - MongoDB $文本搜索未返回预期结果
- php - 在 Prestashop 1.7 的后台显示自定义挂钩
- flutter - 在 Flutter 中使用“bottomNavigationBar”后,“body”部分不可见
- python - 如何在 python 中用 2019-12-17T23:42:20Z 这种格式减去两个日期
- java - 来自嵌套 POJO 的比较器