【发布时间】:2018-05-02 07:02:23
【问题描述】:
我用 Jenkins、nodejs 和 .net core 2.0 设置了一个 ubuntu 16.04 机器,然后尝试让它构建我的 .net core 2.0 Web 应用程序。它失败并显示以下消息:
16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): 警告 MSB3245:无法解析此引用。找不到 程序集“Microsoft.AspNetCore.Authorization”。检查以确保 该程序集存在于磁盘上。如果您需要此参考 代码,你可能会得到编译错误。 [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): 警告 MSB3245:无法解析此引用。找不到 程序集“Microsoft.AspNetCore.Mvc.Abstractions”。检查制作 确保程序集存在于磁盘上。如果需要此参考 你的代码,你可能会得到编译错误。 [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): 警告 MSB3245:无法解析此引用。找不到 程序集“Microsoft.IdentityModel.Tokens”。检查以确保 程序集存在于磁盘上。如果您的代码需要此参考, 你可能会得到编译错误。 [/var/lib/jenkins/workspace/MySolution 主应用程序/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): 警告 MSB3245:无法解析此引用。找不到 程序集“System.IdentityModel.Tokens.Jwt”。检查以确保 程序集存在于磁盘上。如果您的代码需要此参考, 你可能会得到编译错误。 [/var/lib/jenkins/workspace/MySolution 主应用程序/MySolution.Common/MySolution.Common.csproj] 16:32:27 安全/装饰器/ForbiddenResult.cs(5,28):错误 CS0234:类型 或命名空间名称“Mvc”在命名空间中不存在 'Microsoft.AspNetCore'(您是否缺少程序集参考?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 安全/装饰器/GroupMemberAttribute.cs(3,28):错误 CS0234: 命名空间中不存在类型或命名空间名称“Mvc” 'Microsoft.AspNetCore'(您是否缺少程序集参考?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(10,14):错误 CS0234:类型 或命名空间名称“IdentityModel”在命名空间中不存在 “系统”(您是否缺少程序集参考?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(12,17):错误 CS0234:类型 或命名空间名称“IdentityModel”在命名空间中不存在 'Microsoft'(您是否缺少程序集参考?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 安全/装饰器/ForbiddenResult.cs(9,33):错误 CS0246:类型 或找不到命名空间名称“IActionResult”(您是否缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 安全/装饰器/ForbiddenResult.cs(18,40):错误 CS0246:类型 或找不到名称空间名称“ActionContext”(您是否缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(8,51):错误 CS0246: 找不到类型或命名空间名称“IActionFilter”(您是 缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(33,33):错误 CS0246: 找不到类型或命名空间名称“ActionExecutingContext” (您是否缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 安全/装饰器/GroupMemberAttribute.cs(53,32):错误 CS0246: 找不到类型或命名空间名称“ActionExecutedContext”(是 您缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(58,24):错误 CS0246: 找不到类型或命名空间名称“ActionExecutingContext” (您是否缺少 using 指令或程序集引用?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj]
在我的开发机器上,我环顾四周,找不到这些程序集,但我肯定在引用它们,所以我猜它们藏在某个公共位置。
我需要做什么才能让 Jenkins 找到所有引用的程序集并成功构建我的项目?我在网上看到的所有文档似乎都引用了 .net core 1.0 或 1.1,现在看来很多这些东西都不同了。
我的构建步骤非常简单(只有一个)。要做的脚本:
dotnet clean
dotnet restore
dotnet build
【问题讨论】:
-
您能分享一下您在 Jenkins 构建步骤中的内容吗?
标签: c# jenkins asp.net-core continuous-integration