[英]NuGet Restore Issue: Xamarin iOS CSharp Targets was not found
I have a Xamarin Forms Android build pipeline on Azure DevOps, locally my applications build without a problem.我有一个 Xamarin Forms Android 在 Z3A580F142203677F1F0DevODevZF 应用程序上构建管道,本地没有问题。 When the pipeline runs, I get the following error when I attempt to do a NuGet Restore (the ios pipeline uses the same settings and restores without an issue).
当管道运行时,当我尝试执行 NuGet 恢复时出现以下错误(ios 管道使用相同的设置并且恢复没有问题)。
The imported project "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.CSharp.targets" was not found.
This is the line it fails at when trying to a NuGet Restore这是尝试 NuGet 还原时失败的行
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
I was not getting this issue yesterday and I have not made any .csproj
or .sln
changes, so I don't know why this issue has raised, appreciate the help.我昨天没有收到这个问题,我没有对
.csproj
或.sln
进行任何更改,所以我不知道为什么会出现这个问题,感谢帮助。
As I commented, it seems like there was a change to the agents which now do not include the Xamarin Component in VS2022.正如我评论的那样,似乎代理发生了变化,现在不包括 VS2022 中的 Xamarin 组件。 You can read more about this in this GitHub issue: https://github.com/actions/runner-images/issues/6082
您可以在此 GitHub 问题中了解更多信息: https://github.com/actions/runner-images/issues/6082
In that linked issue there is also a workaround, where you can install the Xamarin Component yourself.在那个链接的问题中,还有一个解决方法,您可以自己安装 Xamarin 组件。 Note that this adds around 4 minutes extra to that pipeline just installing that component:
请注意,这仅在安装该组件时为该管道增加了大约 4 分钟的时间:
- pwsh: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd = @(
"Component.Xamarin"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
if ($process.ExitCode -eq 0)
{
Write-Host "components have been successfully added"
}
else
{
Write-Host "components were not installed"
exit 1
}
displayName: "Install Xamarin Components"
The alternative to this is to switch to macOS-12 agents and building on those instead.对此的替代方法是切换到 macOS-12 代理并在这些代理上进行构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.