【问题标题】:Visual Studio 2017 fail to connect macOS virtual machine installed visual studio for mac and xcodeVisual Studio 2017 无法连接 macOS 虚拟机安装的 Visual Studio for mac 和 xcode
【发布时间】:2018-04-02 03:49:36
【问题描述】:

将 Visual Studio 连接到我的 macOS 时出现以下错误。我正在 Win OS 上的 Visual Studio 中构建一个 iphone 应用程序。尝试运行应用程序时显示此错误:

无法验证 Xcode 许可证状态,因为在连接的 MAC 上找不到“xcodebuild”工具。安装和运行 Xcode 是构建和运行 iOS 应用程序所必需的,因此请检查 xcode 是否已正确安装以及在 iOS 设置下指定的路径是否正确。

查看错误截图:

日志:

Xamarin.Messaging.Ssh.MessagingService|Information|0|Agent IDB 4.9.0.752 正在运行
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 xma/agent-status 的应用程序消息
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|IDB 4.9.0.752 已启动
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|正在启动注册代理:...
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|服务器状态从 AgentsStartingState 转换到 AgentsStartedState 在 192.168.106.128 (192.168.106.128)
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|代理已成功启动
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|在 192.168.106.128 (192.168.106.128) 上从 AgentsStartedState 到 ValidatingState 的服务器状态转换
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|针对“192.168.106.128”执行服务器验证...
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|正在验证 Mac 操作系统版本兼容性...
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将 SubscribeAck 消息发送到流 ClientSubscribeFlow
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 xma/message-status
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 xma/message-status 的应用程序消息
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 vs6604UmerF/response/xma/get-env-info
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 vs6604UmerF/response/xma/get-env-info 的应用程序消息
Xamarin.Messaging.Integration.State.ServerStateContext|信息|0|正在验证 Xcode 许可证状态...
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 xma/message-status
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 xma/message-status 的应用程序消息
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将 SubscribeAck 消息发送到流 ClientSubscribeFlow
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 xma/message-status
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 xma/message-status 的应用程序消息
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 vs6604UmerF/response/xvs/idb/4.9.0.752/get-xcode-location
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 vs6604UmerF/response/xvs/idb/4.9.0.752/get-xcode-location 的应用程序消息
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Client vs6604UmerF - 将发布消息分发到流 PublishReceiverFlow 和主题 xma/message-status
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs6604UmerF - 收到主题 xma/message-status 的应用程序消息
Xamarin.Messaging.Ssh.SshCommandRunner|Warning|0|无法执行 '/bin/bash -c 'find "/Applications/Xcode.app/Contents/Developer/usr/bin" -type f | grep xcodebuild'': ExitStatus = 1
Xamarin.Messaging.Ssh.SshCommandRunner|Warning|0|发现:/Applications/Xcode.app/Contents/Developer/usr/bin:没有这样的文件或目录

【问题讨论】:

  • 我也有同样的问题... xcodebuild 甚至不在“/Applications/Xcode.app/Contents/Developer/usr/bin”中

标签: c# ios xcode xamarin xamarin.forms


【解决方案1】:

在我的情况下,终端命令“xcode-select -print-path”告诉我 XCode 应用程序安装在文件夹中:“/Library/Developer/CommandLineTools”,但将其添加到“工具|选项| Xamarin | iOS 设置不起作用。

我终于通过添加Xcode路径解决了它:/Applications/Xcode.app

【讨论】:

  • 更新到 Visual Studio 2019 v16.9 后出现此错误,这是我的修复方法
  • 需要更多的赞成票,就像我昨天升级到 16.9 版后开始的 @DuncanWatts 一样。浪费了好几个小时才看到这篇文章
  • 非常感谢您!在升级到 VS 16.9 后,这也为我解决了这个问题。虽然在我的情况下xcode-select -print-path 给了/Application/Xcode.app/Contents/Developer,但我必须为 VS 中的 Xcode 路径设置准确地输入它。
【解决方案2】:

在您的 Mac 上:

1) 是否安装了Xcode

2) 打开Xcode.app 并在出现提示时接受许可

3) 可选:运行 xcode-select --install 以安装 Xcode 命令行工具并在出现提示时接受许可

4) 运行 xcode-select -print-path 以确保它指向的目录与 Visual Studio 中 Xamarin iOS 选项设置的目录相同,即

  /Applications/Xcode.app/Contents/Developer

回复:https://docs.microsoft.com/en-us/visualstudio/mac/installation

【讨论】:

  • 我的 xcode 路径是 /Users/umermhr/Downloads/Xcode.app/Contents/Developer 但 Visual Studio xcode 路径已禁用。 VS中无法更新路径。
  • Mac配对需要激活,然后您可以取消选择“使用默认Xcode路径”并输入您需要的那个。
  • 等等,所以你需要更改XCode的路径才能与Mac配对,但只有与Mac配对才能更改路径?这听起来不太对,是吗?
  • @ViníciusQueiroz “配对”是一个 ssh 连接,因此要更改 Xcode 路径,它需要该连接来验证结果,它当时没有构建任何东西,所以是的,听起来对我来说;-)
  • @SushiHangover 我想你的意思是文件格式是 .xip 而不是 .xib。
【解决方案3】:

如果您最近更新了 Xcode,请在 xcode Preferences->Accounts->signin 中检查登录

我遇到了同样的问题,使用我的 Apple ID 成功登录后解决了。

在我的情况下,我已经复制并安装了在同事的 mac 中下载的 xcode.xip 文件 我必须删除它并从 appstore 更新 xcode。

【讨论】:

  • 和我一样的经历。刚刚从 Xcode 10 -> 11 升级。配对与 10 一起工作,但升级后出现 idb 错误。打开新的 Xcode 并使用我的 Apple ID 登录,一切顺利
【解决方案4】:

正如@SushiHangover 建议的那样,您必须确保“指向 XCode 路径的目录与 Visual Studio 中 Xamarin iOS 选项中的目录相同”,问题是在某些情况下您无法在建立之前设置它连接(已禁用)

唯一的解决方案是将您的 Xcode.app 移动到应用程序文件夹的默认位置,并将命令行工具移动到 /Applications/Xcode.app/Contents/Developer:

【讨论】:

  • 感谢您 - 已经迷失了很久,尝试了各种方法。事实证明,虽然我的 Xcode 在默认位置,但我已经安装了 xcode-beta.app
【解决方案5】:

我通过使用以下命令从终端重置命令行工具来解决相同的问题: sudo xcode-select --reset

此命令将我的默认路径从 /Library/Developer/CommandLineTools 更改为 /Applications/Xcode.app/Contents/Developer。之后连接开始工作。

【讨论】:

  • 这适用于我重新安装的机器,使用 XCode 12.4 和 Visual Studio 2019 16.9.2 (Windows)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-04
  • 2018-02-04
  • 2018-05-06
  • 2017-04-25
  • 1970-01-01
相关资源
最近更新 更多