繁体   English   中英

类型或名称空间名称“文件”在名称空间“ System.IO”中不存在

[英]The type or namespace name 'File' does not exist in the namespace 'System.IO'

我正在尝试创建一个脚本,该脚本将使用C#在Visual Studio上打开CSV文件,但是当我引用File类时,将弹出错误:

The type or namespace name 'File' does not exist in the namespace 'System.IO' 

我确保我正在using System以及using System.IO ,并添加了对System.dllSystem.IO.dll引用,但是当我尝试添加它们时,出现错误:

A reference to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.dll' could not be added. This component is already automatically referenced by the build system.

System.IO.dll的相同错误。

我正在使用.NETFramework v4.6和Visual Studio 2015。

该组件已由构建系统自动引用

该消息特定于不支持File类的项目模板类型。 Windows应用商店,电话或通用。 定位目标时,您必须跳过更多的循环,运行时代理对文件系统进行了操作,以确保您在允许查找的地方四处浏览。 并且必须始终使用异步代码来完成它,因为它可能很慢。

Windows.Storage.StorageFile类大致相似。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM