Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 类型或命名空间';隔离存储';命名空间中不存在';System.IO';(是否缺少程序集或引用?)_C#_Storage_Isolatedstorage - Fatal编程技术网

C# 类型或命名空间';隔离存储';命名空间中不存在';System.IO';(是否缺少程序集或引用?)

C# 类型或命名空间';隔离存储';命名空间中不存在';System.IO';(是否缺少程序集或引用?),c#,storage,isolatedstorage,C#,Storage,Isolatedstorage,我遇到了一个独立存储的问题,基本上我正在为windows phone和windows桌面制作一个应用程序,用于我在windows phone中的独立存储。我正在使用以下程序: System.IO.IsolatedStorage.IsolatedStorageFile userStore = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication(); using (var isoFileStream =

我遇到了一个独立存储的问题,基本上我正在为windows phone和windows桌面制作一个应用程序,用于我在windows phone中的独立存储。我正在使用以下程序:

System.IO.IsolatedStorage.IsolatedStorageFile userStore = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();

using (var isoFileStream = new System.IO.IsolatedStorage.IsolatedStorageFileStream("students.txt", System.IO.FileMode.Open, userStore))
{
    using (var isoFileReader = new System.IO.StreamReader(isoFileStream))
    {

    }
}

我假设windows桌面也是一样的,但显然不是,有没有不同的方法来实现同样的目标?避免错误

您可能正在为Windows应用商店(Windows 8及以上版本)开发.NET应用程序,而不是普通的Win Forms应用程序。您需要使用
Windows.Storage
命名空间

没有直接的System.IO.IsolatedStorage命名空间


使用
Windows.Storage.ApplicationData.Current.LocalData
而不是
System.IO.IsolatedStorage.IsolatedStorageFile
类。

我刚刚创建了一个新的WinForms应用程序(File->new->Project->Windows Forms应用程序),它就在那里。我甚至尝试切换到一个旧的框架和客户端配置文件,它仍然被认可。根据文档,它是在mscorlib中定义的,所以它不应该是一个参考问题。@CraigW-hmm我不确定,因为这就是出现的问题。你有什么想法吗?我唯一的想法是框架的一个版本不支持它,但我一直回到2.0,每次编译都很好。我甚至删减了对System、System.Drawing和System.Windows.Forms的引用,它仍然在编译。我的建议是尝试创建一个新的分支项目,并将第一行代码放入其中。如果这对你有效,那么原始项目存在一些配置问题,你需要反复尝试才能弄清楚它是什么。@CraigW我制作应用程序的方式是(文件->新建->项目->空白应用程序)我刚刚再试了一次,但仍然不起作用dd,我没有“空白应用程序”的选项在“新建项目”对话框中。抱歉,我恐怕帮不了什么忙,因为我的环境显然与您的环境非常不同。我已经在使用Windows.Storage和Windows.Storage.Pickers。msdn证实了@raja所说的:
独立存储不适用于Windows应用商店应用。相反,请使用Windows运行时API中包含的Windows.Storage命名空间中的应用程序数据类来存储本地数据和文件。有关更多信息,请参阅Windows开发中心中的应用程序数据。