如何将外部用户文件包含在UWP侧载软件包中?
假设我使用一些.json文件来描述一些对程序行为影响的对象数据,我希望在以下方案中使用这些文件
默认值,为此,我需要一组文件。被包装和安装。
我希望可以手动对其进行编辑。 (因为在UI上没有任何接口可以修改)
用户和程序都需要在安装后放置文件的位置。
在调试阶段,我可以将这些文件放入用户\ appdata \ local ..文件夹中,我知道如何访问它们,但是我不知道如何将文件放入包装中,并且在安装后会生成到任何地方吗?
谢谢您的建议。
PS。
- 我使用“空白应用(UWP中的winui 3)” 模板来创建我的 应用。
- 我是UWP和Winui的新手,我曾经编写传统的Windows表单程序。
Say I use some .json files to descript some object data which effect to the program's behavior, I hope to use these files in the following scenarios
The default values, for this purpose, I need a set of files follows with the application to be packed and installed.
I wish it could be edited by human manually. (Because something have no interface to be modify on UI)
Both user and the program need to kwnow the location the files will be placed after installation.
In debugging stage, I could put these files in the user\AppData\Local.. folder and I know how to access them, but I don't know how to put files into the package and will them generated to anywhere after install?
Thank you for any suggestion.
ps.
- I use the "Blank App (WinUI 3 in UWP)" template to create my
application. - I'm new in UWP and WinUI, I used to write traditional Windows Form programs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将JSON文件放入应用程序的项目中,并将文件属性设置为
content
,然后将其部署到 installtion> installtion 包装安装后的文件夹。并请注意,JSON文件已在“安装”文件夹中阅读。so you could call CopyAsync method copy the file to the destination folder that app's
有关文件的更多详细信息访问权限请参考此文档。
You could place the json file into app's project and set the file property as
Content
, then it will deploy into installtion folder after package install. and please note the json file is readonly in the installtion folder.so you could call CopyAsync method copy the file to the destination folder that app's local folder with full permission.
For more details about file access permissions please refer this document.