【问题标题】:Class Library System.IO.File类库 System.IO.File
【发布时间】:2015-08-27 02:54:31
【问题描述】:

我正在构建一个 Visual Studio 2015 C# 类库项目。显然 System.IO.File 不再可用。 其他开发人员采取了哪些措施来解决这个问题? 我找错地方了吗? FILE 库功能是否已完全删除,现在我需要下载一个包?

using System; 
using System.Collections.Generic;
using System.Diagnostics; 
using System.IO; 
namespace Framework.File 
{ 
    public class UTL 
    { 
        public bool Read() 
        { 
            try 
            {
                using (StreamReader fileReader = System.IO.File.OpenText(Name)) 
    . . . . . 

谢谢

【问题讨论】:

标签: c# visual-studio-2015


【解决方案1】:

确保您有 using 语句,并确保您在引用下有 System dll。

using System;
using System.IO;

namespace ClassLibrary1
{
    public class Class1
    {
        private StreamReader _sr = System.IO.File.OpenText("c://temp//boom.text");
    }
}

它还在那里。 https://msdn.microsoft.com/en-us/library/system.io(v=vs.110).aspx http://referencesource.microsoft.com/#mscorlib/system/io/file.cs,1c7421e464f67b7e

【讨论】:

  • 我有以下用途:
  • 使用系统;使用 System.Collections.Generic;使用 System.Diagnostics;使用 System.IO;
  • 但我收到了这个讨厌的错误:CS0234 类型或命名空间名称“文件”在命名空间“System.IO”中不存在(您是否缺少程序集引用?) Framework..NET 平台
  • 确保你有这两个引用。
猜你喜欢
  • 1970-01-01
  • 2016-07-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-13
  • 2011-04-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多