如何将外部用户文件包含在UWP侧载软件包中?

发布于 2025-01-29 08:20:45 字数 424 浏览 3 评论 0原文

假设我使用一些.json文件来描述一些对程序行为影响的对象数据,我希望在以下方案中使用这些文件

  1. 默认值,为此,我需要一组文件。被包装和安装。

  2. 我希望可以手动对其进行编辑。 (因为在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

  1. The default values, for this purpose, I need a set of files follows with the application to be packed and installed.

  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮生未歇 2025-02-05 08:20:45

如何将外部用户文件包括在UWP侧加载软件包中?

您可以将JSON文件放入应用程序的项目中,并将文件属性设置为content,然后将其部署到 installtion> installtion 包装安装后的文件夹。并请注意,JSON文件已在“安装”文件夹中阅读。
so you could call CopyAsync method copy the file to the destination folder that app's

有关文件的更多详细信息访问权限请参考此文档。

How to include externel user files into UWP side-loading package?

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文