Appveyor Xamarin:组件导致 CI 服务器失败
Appveyor Xamarin: Components cause CI server to fail
我向我的 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
它在我的环境中构建并运行良好。可能是什么问题?
退出代码 2:
Unrecognized command.
它没有为您的 unzip/extract 步骤找到 7z
命令。
尝试 get-7zip.ps1
如果您还没有:
Write-Host "Installing 7-Zip ..."
$instPath = "$env:ProgramFiles-Zipz.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")
bit = ''
if ($env:PROCESSOR_ARCHITECTURE -match '64')
{
bit = 'x64'
}
$pattern = "(http://.*?${64bit}\.msi)"
$url = $page | Select-String -Pattern $pattern | Select-Object -ExpandProperty Matches -First 1 | foreach { $_.Value }
$file = "$env:TEMPz.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."
}
我向我的 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
它在我的环境中构建并运行良好。可能是什么问题?
退出代码 2:
Unrecognized command.
它没有为您的 unzip/extract 步骤找到 7z
命令。
尝试 get-7zip.ps1
如果您还没有:
Write-Host "Installing 7-Zip ..."
$instPath = "$env:ProgramFiles-Zipz.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")
bit = ''
if ($env:PROCESSOR_ARCHITECTURE -match '64')
{
bit = 'x64'
}
$pattern = "(http://.*?${64bit}\.msi)"
$url = $page | Select-String -Pattern $pattern | Select-Object -ExpandProperty Matches -First 1 | foreach { $_.Value }
$file = "$env:TEMPz.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."
}