允许 WPF 应用程序写入 XML 文件
我开发了一个 WPF 应用程序并设置了一个部署项目。安装程序和应用程序都可以完美运行,直到它尝试在 XML 文件中进行输入。这些文件充当应用程序的 XML 数据库,并包含在应用程序文件夹中。我哪里错了。我需要分配某种权限吗
I have developed a WPF application and set up a deployment project. The installer works perfectly and so does the application, until it tries to do a entry in an XML file. These file act as an XML database for the application and are included in Application folders. Where am i going wrong. Do i need to assign some kind of privileges
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,应用程序的注释有误。
你必须阅读文档。从 Windows NT4 或其他版本开始,您不应该写入应用程序文件夹。有一些特殊的文件夹可供写入,以及获取它们的方法。在普通的现代 Windows 上,应用程序文件夹对普通用户来说是写保护的,这是应该的。这是程序文件夹。
将数据移至 APPDATA 文件夹中的数据库子文件夹中。
从 http://msdn.microsoft.com/en-us 开始/library/system.environment.specialfolder.aspx 用于文档。
阅读 Windows 平台编程指南。那里有很多“做”和“不做”。写入应用程序文件夹是首先“不要做”的事情之一。
No, noting is wrong with the app.
You have to read documentation. You are NOT SUPPOSED TO WRITE INTO THE APPLICATION FOLDER since Windows NT4 or something. There are special folders to write into, and a method to get them. On normal modern windows the app folder is write protected for normal users, as it should be. It is the program folder.
Move your data over to the APPDATA folder, into a subfolder for your database.
Start at http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx for documentation.
Read the Windows guideleines for programming for the windows platform. There are a number of "do" and "do not do" there. Writing into the applications folder is one of the first "do not do".