【问题标题】:Error CS0246 The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?)错误 CS0246 找不到类型或命名空间名称“Windows”(您是否缺少 using 指令或程序集引用?)
【发布时间】:2019-12-02 12:45:06
【问题描述】:

我想运行 Xamarin 项目并完成所有更新。当我运行项目时,出现以下错误

找不到类型或命名空间名称“Windows”(您是否缺少 using 指令或程序集引用?)

为了线条

using Windows.Storage; 
using Windows.ApplicationModel.ExtendedExecution;

【问题讨论】:

  • 点击错误时;使用Windows.Storage时出错;使用 Windows.ApplicationModel.ExtendedExecution;
  • 您甚至没有解释您使用的平台以及您在哪里看到错误。如果您在 iOS 或 Android 上看到此错误,则应该是

标签: c# xamarin xamarin.forms visual-studio-2017


【解决方案1】:

那是因为你缺少这些 .dll

Windows Blog 上的专用博客文章中列出了访问 UWP API 的推荐步骤。 基本上你可以采取两种方法:手动添加对 UWP dll 和 winmd 文件的引用,或者使用 UwpDesktop NuGet 包,它会自动为你解决这个问题。

更多详情可以查看:How do I get access to Windows.Storage namespace?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 2020-02-19
    • 1970-01-01
    • 1970-01-01
    • 2022-06-15
    • 2020-08-29
    • 1970-01-01
    相关资源
    最近更新 更多