如何在Windows应用商店(WinRT)应用程序中启用DocumentsLibrary功能? [英] How to enable DocumentsLibrary capability in a Windows store (WinRT) app?

查看:43
本文介绍了如何在Windows应用商店(WinRT)应用程序中启用DocumentsLibrary功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Visual Studio中创建了一个新的空白XAML/C#Windows Store应用程序.我尝试使用以下代码在文档"文件夹中创建文件:

I just created a new blank XAML/C# Windows Store app in Visual Studio. I tried to create a file in the Documents folder with this code:

// DEBUG ONLY:
StorageFile file = await KnownFolders.DocumentsLibrary.CreateFileAsync("Hey lol.txt");

但是它抛出了这个异常(这是我所期望的):

But it throws this exception (which I expected):

WinRT信息:要访问指定位置(DocumentsLibrary),需要具有在清单中声明的​​功能.

WinRT information: Access to the specified location (DocumentsLibrary) requires a capability to be declared in the manifest.

哪个很好.我预料到了.因此,我转到 Package.appxmanifest 并转到 Capabilities 选项卡,令我惊讶的是,没有列出"DocumentsLibrary"功能.

Which is fine. I expected it. So I go to Package.appxmanifest and go to Capabilities tab, and to my surprise, there is no "DocumentsLibrary" capability listed.

如果它还不存在,如何启用它?

How do I enable it if it's not even there?

推荐答案

您的答案似乎是

Looks like your answer is here. The author shows it available in VS2012, but gone from the list in VS2013, citing MS policy against accessing that particular folder.

[尽管]该功能仅从UI中消失,但是您仍然可以打开appxmanifest源并手动添加该功能.结果可能与以前相同–个人开发人员的认证失败,因此您最好不要使用此技巧.Microsoft强烈建议您不要使用Documents Library功能,而建议使用文件夹和文件选择器".

[Although] this capability is gone just from the UI, you still can open appxmanifest source and manually add the capability. The result will probably be the same as before – failure of certification for individual developers, so you better stay away from this trick. Microsoft strongly recommend against using Documents Library capability, suggesting Folder and File Pickers instead.

这篇关于如何在Windows应用商店(WinRT)应用程序中启用DocumentsLibrary功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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