【问题标题】:Appveyor Xamarin: Components cause CI server to failAppveyor Xamarin:组件导致 CI​​ 服务器失败
【发布时间】:2016-08-14 07:21:33
【问题描述】:

我在我的 xamarin android 项目中添加了一个组件。 现在,当我的项目在 appveyor 中运行时,它在这一点上失败了:

$zipPath = "$($env:APPVEYOR_BUILD_FOLDER)\xpkg.zip"
(New-Object Net.WebClient).DownloadFile('https://components.xamarin.com/submit/xpkg', $zipPath)
7z x $zipPath | Out-Null
Command exited with code 2

它在我的环境中构建并运行良好。可能是什么问题?

【问题讨论】:

    标签: c# xamarin continuous-integration components appveyor


    【解决方案1】:

    退出代码 2:

    Unrecognized command.
    

    没有为您的解压缩/提取步骤找到7z 命令。

    如果您还没有,请尝试get-7zip.ps1


    Write-Host "Installing 7-Zip ..."
    $instPath = "$env:ProgramFiles\7-Zip\7z.exe"
    if (!(Test-Path $instPath))
    {
        Write-Host "Determining download URL ..."
        $web = New-Object System.Net.WebClient
        $page = $web.DownloadString("http://www.7-zip.org/download.html")
    
        $64bit = ''
    
        if ($env:PROCESSOR_ARCHITECTURE -match '64')
        {
            $64bit = 'x64'
        }
    
        $pattern = "(http://.*?${64bit}\.msi)"
        $url = $page | Select-String -Pattern $pattern | Select-Object -ExpandProperty Matches -First 1 | foreach { $_.Value }
    
        $file = "$env:TEMP\7z.msi"
        if (Test-Path $file)
        {    
            rm $file | Out-Null
        }
    
        Write-Host "Downloading $url -> $file"
    
        $web.DownloadFile($url, $file)
    
        Write-Host "Installing..."
        Write-Host "(Note: please approve the User Account Control (UAC) popup if necessary...)"
    
        $cmd = "$file /passive"
    
        Invoke-Expression $cmd | Out-Null
    
        while (!(Test-Path $instPath))
        {
            Start-Sleep -Seconds 10
        }
    
        Write-Host "Done!"
    }
    else
    {
        Write-Host "7-Zip already installed."
    }
    

    https://raw.githubusercontent.com/dougthor42/wafer_map/478faec644c06887d2cf6823457ac8e63a47ce77/appveyor/get-7zip.ps1

    【讨论】:

    • 但我认为 z7 应该预装在 appveyor 环境中?
    • 它已安装并包含在“Build Worker”环境中的路径中,但我们遇到了问题,只是自己安装了它。您可以在构建脚本行上单独尝试 z7 以查看是否找到它
    • 这可能是一个愚蠢的问题,但我如何在 appveyor 上运行脚本我似乎无法让它运行...?
    • 我不断收到以下信息:.\get-7zip.ps1:术语“.\get-7zip.ps1”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称.检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。在 line:1 char:1 + .\get-7zip.ps1 + ~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (.\get-7zip.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
    • 其余:命令执行异常:术语“.\get-7zip.ps1”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,如果包含路径,请验证路径是否正确,然后重试。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 2019-01-18
    • 2021-02-28
    • 2012-02-29
    • 1970-01-01
    相关资源
    最近更新 更多