Appveyor Xamarin:组件导致 CI 服务器失败

本文关键字:CI 服务器 失败 Xamarin 组件 Appveyor | 更新日期: 2024-10-25 04:17:29

我在我的 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

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

Appveyor Xamarin:组件导致 CI 服务器失败

退出代码 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