【问题标题】:Azure DevOps Pipeline PostSharp failure on linux VMLinux VM 上的 Azure DevOps Pipeline PostSharp 失败
【发布时间】:2019-05-08 22:33:14
【问题描述】:

我曾计划将我的 DevOps 管道移至 linux vm。不幸的是,我遇到了这个问题。我在 .Net Core 2.2 项目中使用 Postsharp 6。

Build FAILED.

/home/vsts/.nuget/packages/postsharp/6.1.18/build/PostSharp.targets(148,5): error MSB4062: The "PostSharp.MSBuild.PostSharpValidateLanguageVersion" task could not be loaded from the assembly /home/vsts/.nuget/packages/postsharp/6.1.18/build//net471/PostSharp.MSBuild.v6.1.18.Release.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/home/vsts/work/1/s/Core.csproj]
/home/vsts/.nuget/packages/postsharp/6.1.18/build/PostSharp.targets(148,5): error MSB4062: Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/home/vsts/work/1/s/Core.csproj]

0 Warning(s)
1 Error(s)

【问题讨论】:

    标签: azure-devops continuous-integration azure-pipelines postsharp


    【解决方案1】:

    PostSharp 不适用于 Linux 虚拟机。

    唯一的解决方案是在 yaml 上使用 Windows Server。甚至 Selenium 也取消了对 Postharp 的支持。

    trigger:
    - master
    
    pool:
      vmImage: 'windows-2019'
    
    variables:
      buildConfiguration: 'Release'
    
    steps:
    - script: dotnet build --configuration $(buildConfiguration)
    displayName: 'dotnet build $(buildConfiguration)'
    

    您可以查看图片以更好地了解步骤。


    • 更新

    PostSharp 6.3.5 预览版 版本支持 Linux 和 macOS 构建。

    另外,你也可以创建一个 docker 镜像。我正在使用这些图片:

    FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
    FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
    

    【讨论】:

    • 确切地说,PostSharp 仅支持在 Windows 上构建,但生成的程序集也可以在 Linux 上执行。在 Linux 上构建的支持在路线图中具有高优先级。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-10
    • 2020-10-18
    • 2020-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多