asp.net-mvc - 未找到框架“.NETFramework,Version=v4.6.1”的参考程序集。尝试使用管道 jenkinsfile 构建时出错
问题描述
我已经尝试了另一个 docker 文件来使构建工作没有任何帮助.. iam 使用 asp.net-mvc5
当我尝试从詹金斯构建时出现错误:
Restore completed in 2.44 sec for /opt/bitnami/apps/jenkins/jenkins_home/jobs/Team21/jobs/Project/workspace/WebAppTest/WebAppTest.csproj.
/opt/bitnami/apps/jenkins/jenkins_home/jobs/Team21/jobs/Project/workspace/WebApplication2/WebApplication2.csproj(482,3): error MSB4019: The imported project "/opt/bitnami/apps/jenkins/jenkins_home/jobs/Team21/jobs/Project/workspace/WebApplication2//MSBuild/Microsoft/VisualStudio/v14.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
/usr/share/dotnet/sdk/2.2.203/Microsoft.Common.CurrentVersion.targets(1183,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/opt/bitnami/apps/jenkins/jenkins_home/jobs/Team21/jobs/Project/workspace/WebAppTest/WebAppTest.csproj]
Build FAILED.
0 Warning(s)
2 Error(s)
管道 jenkins 文件 iam 使用:
pipeline {
//Use the following docker image to run your dotnet app.
agent { docker { image 'mcr.microsoft.com/dotnet/core/sdk:2.2.203-
alpine'} }
environment {HOME = '/tmp'}
stages {
// Get some code from a GitHub repository
stage('Git') {
steps{
git 'https://github.com/user/project.git'
}
}
// stage('Dotnet Restore'){
// steps{
// sh "dotnet restore"
// }
// }
stage('Build') {
steps {
sh "dotnet build"
}
}
stage('Unit Tests') {
steps {
sh 'dotnet test'
}
}
}
}
解决方案
例外是为您提供答案:
要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack
您缺少要在 Jenkins 上执行的任务的正确框架,因此您必须安装它。
推荐阅读
- android - java.net.UnknownServiceException:网络安全策略不允许与 t.main.wedeep.com.cn 进行 CLEARTEXT 通信
- angular - 尝试对 Angular 进行 docker 化时出现 Dockerfile 错误 - 没有这样的文件或目录
- sql - 正则表达式查找字符串中的特定字符
- grafana - 如何捕获 GRAFANA 刷新按钮
- reactjs - 如何将 React-number-format 应用于反应中的一组数字
- database - Flutter + 全局变量还是 SQL?
- c# - 由 IHttpClientFactory 注入时模拟 HttpClient 处理程序
- android - viewpager2 中的 recyclerView 将在导航中从下一页返回后自动向上滚动
- java - Java:按给定字符串属性的子字符串对对象列表进行排序(模式 ITEM/LOC/YYYY/N)
- ssas - SSAS 表格模型 - 将列添加到现有表