开发 Windows 应用商店应用期间的本地文件存储 [英] Local file storage during development of a Windows Store App

查看:27
本文介绍了开发 Windows 应用商店应用期间的本地文件存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我开始使用 Windows 商店应用程序.这也是我第一次使用 Visual Studio.Windows 8.1 也是如此:P

So I'm getting started in windows store apps. It is also my first experience with Visual Studio. Windows 8.1 for that matter, too :P

我正在尝试弄清楚在这个项目的开发阶段本地文件存储是如何工作的.我了解 appdata 目录和应用程序安装目录在应用程序发布并安装在客户端 PC 上后如何与应用程序交互的概念.这个 SO 答案很好地概述了它应该如何工作.但是,我无法弄清楚在开发过程中,如果应用未安装并且在任何 appdata 目录中没有专用文件夹,我应该如何使用这些概念.

I'm trying to figure out how local file storage works during the dev phase of this project. I understand the concept of how the appdata directory and the application install directory interact with the app once it is published and installed on a client's PC. This SO answer gives a good overview of how it is supposed to work. However, I can't figure out how, during development, I am supposed to use these concepts if the app isn't installed and doesn't have a dedicated folder in any of the appdata directories.

非常感谢任何帮助!

推荐答案

正如其他人所指出的,应用程序将安装在本地,应用程序的数据将驻留在一些常见的地方,例如 C:\Users\YourUserName\开发过程中的 AppData\local\packages.检查 Package.appxmanifest 文件的 Packaging 选项卡以确定 Package 系列名称,它可能会有些神秘.packages 文件夹下会有对应的文件夹.

As others have pointed out, the app will be installed locally and the app's data will reside in some common place like C:\Users\YourUserName\AppData\local\packages during development. Check with the Packaging tab of your Package.appxmanifest file to determine the Package family name, it's probably going to be something cryptic. There'll be a corresponding folder in the packages folder.

不过,还有一件事.从 .appx 文件安装的应用(例如,通过商店或旁加载到设备上)与 Visual Studio 在调试时将为你执行的安装类型之间存在差异.后者是所谓的未打包安装",作为应用程序包一部分的应用程序文件的布局会略有不同,具有不同的含义.最重要的是,您将能够修改应用程序包中文件的内容,这对于从 .appx 安装的同一个应用程序将失败.此外,如果计算机上存在未打包安装,您将无法安装应用程序的打包版本.(当然,AppData 文件夹中的文件在任何一种情况下都会以相同的方式运行.)

One additional thing, though. There's a difference between an app that's been installed from an .appx file (e.g., through the store or side-loaded onto a device), and the type of installation that Visual Studio will perform for you when debugging. The latter is a so-called "unpackaged installation", and the application files that are part of your app package will be laid out slightly differently, with different implications. Most importantly, you will be able to modify the contents of files in your app package, which will fail for the same app when installed from an .appx. Also, you won't be able to install a packaged version of an app if an unpackaged install is present on the machine. (Of course, files in the AppData folder will behave the same way in either case.)

这篇关于开发 Windows 应用商店应用期间的本地文件存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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