找不到类型或命名空间名称“Windows”

Posted

技术标签:

【中文标题】找不到类型或命名空间名称“Windows”【英文标题】:The type or namespace name 'Windows' could not be found 【发布时间】:2017-11-10 15:17:59 【问题描述】:

我正在尝试为我的 hololens 应用程序使用文件选择器。但我无法使用它,因为我的项目无法添加“windows”引用。

当我写using Windows.Storage

The type or namespace name 'Windows' could not be found -- 此错误信息在 Windows 下出现红线。

我尝试使用引用管理器添加引用,但在程序集 - 框架中找不到任何东西,例如 Windows。

谁能帮我解决这个问题?谢谢!

【问题讨论】:

什么项目类型? 重申@SLaks - 什么类型的项目?我能够启动一个 Unity 3D 项目,添加一个脚本并且我可以访问 Windows.Storage; -- 与启动新的空白 UWP 应用程序相同。让我们知道,并乐于提供帮助。 :) @SLaks 谢谢,应用程序 - 输出类型表示类库。是这个原因吗? @LanceLarsen 谢谢,应用程序 - 输出类型表示类库。是这个原因吗? 如果您将 8.1 替换为 Windows 版本,Manohar Reddy Poreddys answer 可以完美运行。 【参考方案1】:

我缺少 Win 8.1 SDK,所以出现错误。

以下步骤解决了我的问题:

Download and Start the "Visual Studio installer"  
  Click on the "Modify" button  
    Click "Individual components" tab  
    Under "SDKs, libraries and frameworks" heading  
      Select "Windows 8.1 SDK" (replace 8.1 with your Windows version.)  
      Click "Modify" to install  

希望对您有所帮助。

【讨论】:

以上是关于找不到类型或命名空间名称“Windows”的主要内容,如果未能解决你的问题,请参考以下文章

vs2008中的错误 1 找不到类型或命名空间名称“Graphics”(是不是缺少 using 指令或程序集引用?)怎么解决?急

有问题,找不到类型或命名空间名称“List”

找不到类型或命名空间名称“异步”[重复]

找不到类型或命名空间名称“DbContext”[关闭]

找不到类型或命名空间名称“readFullyStream”

在 Xamarin Studio 中找不到类型或命名空间名称“页面”