【问题标题】:After updating Xamarin I get referenced component *** could not be found更新 Xamarin 后,我得到引用的组件 *** 找不到
【发布时间】:2018-01-20 16:28:36
【问题描述】:

通过 NuGet 更新 Xamarin 表单后,我无法再构建我的 Android 应用程序。这是错误:

Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see ... The missing file is ..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props

Warning The referenced component 'Xamarin.Forms.Platform.Android' could not be found.
Warning The referenced component '***' could not be found. (for all my references except my own added reference "shared code")

Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.

Warning "\packages\Xamarin.Forms.2.5.0.122203\build\netstandard1.0\Xamarin.Forms.props" cannot be imported again. It was already imported at "\RajaChat.Android\RajaChat.Android.csproj (3,3)". This is most likely a build authoring error. This subsequent import will be ignored.

我已经从堆栈溢出或 xamarin 论坛上的答案中尝试了以下内容:

  • 删除包文件夹,让 nuget restore 恢复包
  • 将 nuget 控制台与“Update-Package –reinstall”一起使用
  • 通过删除 obj 和 bin 文件夹来清理构建和重建
  • 降级到 Xamarin.Build.Download 0.4.6
  • 卸载并重新加载 Android 项目

没有任何帮助,总是相同的输出...

我打开了TRACEDESIGNTIME 来调试IDE0006 Error,但它只给了我与上面*.designtime.log 相同的错误:

\RajaChat\RajaChat\RajaChat.Android\RajaChat.Android.csproj(308,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see . The missing file is ..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props.

使用 Visual Studio 2017Xamarin Forms 2.5.0.122203

【问题讨论】:

    标签: visual-studio xamarin xamarin.forms


    【解决方案1】:

    从您的解决方案中删除 nuget 包 Xamarin.Forms,在您的 Android 项目的 .csproj 中,删除您的 Xamarin.Forms 包的导入(检查是否有多个引用并删除它们)。
    它应该是这样的:

    <PackageReference Include="Xamarin.Forms" Version="2.5.0.121934" />
    

    然后从packages 文件夹中删除Xamarin.Forms 包。
    现在解决方案应该没有Xamarin.Forms 包引用,添加Xamarin.Forms Nuget 包并重新构建。

    【讨论】:

    • 如果仍有错误:卸载项目。使用完 nugets 后重新加载项目。
    • 哇,在这里挂了 3 天,成功了!我在文件中没有任何&lt;PackageReference&gt; 标签,但我删除了所有出现Xamarin.Forms 的标签。非常感谢!
    【解决方案2】:

    删除所有引用并删除 .Droid 中的 bin 和 object 文件夹。然后保存并重新打开解决方案。等待几秒钟,让 VS 下载并添加来自 nauget 的所有引用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-23
      • 2010-12-28
      • 1970-01-01
      • 2016-07-23
      • 2021-07-08
      • 2012-06-12
      相关资源
      最近更新 更多