c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?

c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?,第1张

概述我刚刚在Visual Studio中创建了一个新的空白XAML / C# Windows应用商店应用.我尝试使用以下代码在Documents文件夹中创建一个文件: // DEBUG ONLY:StorageFile file = await KnownFolders.DocumentsLibrary.CreateFileAsync("Hey lol.txt"); 但它抛出了这个异常(我预期): 我刚刚在Visual Studio中创建了一个新的空白XAML / C# Windows应用商店应用.我尝试使用以下代码在documents文件夹中创建一个文件:
// DEBUG ONLY:Storagefile file = await KNownFolders.documentslibrary.CreatefileAsync("hey lol.txt");

但它抛出了这个异常(我预期):

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

哪个好.我期待它.所以我转到Package.appxmanifest并转到CapabilitIEs选项卡,令我惊讶的是,没有列出“documentslibrary”功能.

如果它不存在,我该如何启用它?

解决方法 看起来你的答案是 here.作者在VS2012中显示它,但是从VS2013的列表中删除,引用了MS策略来访问该特定文件夹.

[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.

总结

以上是内存溢出为你收集整理的c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?全部内容,希望文章能够帮你解决c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1236366.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存