vb.net中的虚拟商店 [英] Virtualstore in vb.net

查看:108
本文介绍了vb.net中的虚拟商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在程序文件(即已安装的目录)中读写一些配置文件.

不幸的是,每当我写或读它时,都会从虚拟商店中的虚拟商店中获取

C:\ users \ user-a \ AppData \ Local \ VirtualStore \ Program Files(x86)

我正在使用Windows 7 64位系统.因此,我的应用程序给出了错误的结果.

I am reading and writing some configuration files in the Program Files i.e installed directory.

unfortunately whenever i write or read it is taking from Virtual store in Virtual store

C:\users\user-a\AppData\Local\VirtualStore\Program Files (x86)

i am using windows 7 64bit system. Because of this my application is giving wrong results.

how do i resolve this.

推荐答案

将您的配置文件写到它们所属的地方!
它既可以是用户的ApplicationData文件夹,也可以是ProgramData文件夹.您可以使用Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)CommonApplicationData来获得它们.
顺便说一句,不要将文件直接写到那些文件夹中.相反,请使用公司名称创建一个文件夹,并使用程序名称创建一个文件夹,并在其中添加您的配置文件.
Write your configuration files to a place where they belong to!
It is either the ApplicationData folder of the user the the ProgramData folder. You get them with Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) or CommonApplicationData.
By the way, do not write your files directly into those folders. Instead, create a folder with your company name, and there a folder with the program name, and there come your configuration files.


那是因为Program Files文件夹对于普通用户是只读的用户.您的代码根本不应该在Program Files下的任何地方写入任何内容.

就像Bernard所说的那样,将您的数据放在更合适的位置.如果您不知道这应该是什么,请阅读此列表 [ ^ ].
That''s because the Program Files folder is readonly to normal users. Your code should not be writing anything to any place under Program Files at all.

Like Bernard has said, put your data in a more appropriate place. If you don''t know what that should be, read up on this list[^].


http://stackoverflow.com/questions/9435714/vb-net-windows-7-64bit-write-file-in-c-windows-system32 [

这篇关于vb.net中的虚拟商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆