【问题标题】:The imported project "Xamarin.iOS.CSharp.targets" was not found error - Visual Studio 7 - Mac未找到导入的项目“Xamarin.iOS.CSharp.targets”错误 - Visual Studio 7 - Mac
【发布时间】:2019-09-26 10:25:01
【问题描述】:

我正在使用带有 Windows 机器的 Visual Studio 2017 Professional 处理 Xamarin.Forms 项目。此外,我正在使用 Mac 通过将 Mac 与 VS 2017 配对来构建和运行 iOS 应用程序。有时 Mac 上的 Visual Studio 也用于为同一项目的 iOS 和 Android 平台构建和运行应用程序,Macbook 具有 Visual适用于 Mac 的 Studio 2017。

最近我不得不恢复 Macbook 并重新安装 Xamarin 开发设置。现在的问题是,如果我为 Mac 安装 VS 2019,它带有 Mono 版本 6.x.x,而我在 Windows 上的 VS 2017 不支持该版本,因为它总是告诉存在“Mono 版本不匹配”并要求安装 Mono 版本5.18.1,但 VS 2019 for Mac 不支持该版本。

然后我从存档中下载了 VS 2017 for mac 并进行了全新安装。之后,当我尝试在 Windows 机器上将 mac 与 VS 配对时,它再次通知“单声道版本不匹配”并安装单声道 5.18.1。使用该版本,即使是简单的 Xamarin.Forms 项目也无法在 Mac 上的 VS 2017 上构建,因为它会报告此错误:

Getting restore information for project /Projects/Hello/Hello.iOS/Hello.iOS.csproj /Projects/Hello/Hello.iOS/Hello.iOS.csproj(153,3) : error MSB4019: The imported project "/Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. Unable to create package spec for project. /Projects/Hello/Hello.iOS/Hello.iOS.csproj

【问题讨论】:

  • 你的 VS 2017 for window 是最新的吗?尝试更新它。也尝试重新安装 Xamarin.iOS。
  • 是的,它有 VS 2017 的最新更新。我尝试重新安装 Xamarin.iOS,但没有帮助。我想我可能不得不将两个平台上的 VS 更新到 2019 年
  • 正在使用的 Mono 完整版是什么,VS Mac 完整版是什么? Mono 5.18.1.24 发生了变化,以支持更高版本的 .NET Core sdks 和更高版本的 MSBuild。您看到的错误看起来像是 VS Mac v7 版本和 Mono 的 MSBuild 不匹配 - github.com/mono/mono/issues/14875#issuecomment-499998067
  • @MattWard 是的,错误是由于两个 VS 版本之间的不匹配而出现的。 Mac 版 VS 2019 需要单声道 6 或更高版本,而 Windows 版 VS 2017 则需要单声道 5.18.1.28。所以目前我将 Mono 5.18.1 保留在 mac 中,因为它可以在 windows 上正常工作。
  • 是的,尝试两边都使用最新版本。

标签: visual-studio xamarin.ios mono visual-studio-mac


【解决方案1】:

不是最好的解决方案,但将两个平台上的 Visual Studio 更新到 2019 年解决了这个问题。

【讨论】:

    猜你喜欢
    • 2020-07-30
    • 1970-01-01
    • 2021-11-15
    • 2019-10-28
    • 2017-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多