Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Appveyor Xamarin:组件导致CI服务器失败_C#_Xamarin_Continuous Integration_Components_Appveyor - Fatal编程技术网

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

C# Appveyor Xamarin:组件导致CI服务器失败,c#,xamarin,continuous-integration,components,appveyor,C#,Xamarin,Continuous Integration,Components,Appveyor,我在XamarinAndroid项目中添加了一个组件。 现在,当我的项目在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 w

我在XamarinAndroid项目中添加了一个组件。 现在,当我的项目在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.
它找不到解压/提取步骤的
7z
命令

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




但我认为z7应该预先安装在appveyor环境中?它已安装并包含在“Build Worker”环境中的路径中,但我们遇到了一个问题,只是自己安装了它。您可以在构建脚本行上单独尝试
z7
以查看是否找到它。这可能是一个愚蠢的问题,但我如何在appveyor上运行脚本?我似乎无法让它运行…?我一直得到以下信息:。\get-7zip.ps1:术语“.\get-7zip.ps1”不能识别为cmdlet、函数、脚本文件或可操作程序的名称。请检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。在第1行,char:1+。\get-7zip.ps1+~~~~~~~~~~~~~~~~~~~类别信息:ObjectNotFound:(。\get-7zip.ps1:String)[],CommandNotFoundException+FullyQualifiedErrorId:CommandNotFoundException剩余:执行的命令中包含异常:术语'.\get-7zip.ps1'未被识别为cmdlet、函数、脚本文件的名称,或可操作程序。请检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。
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."
}