UnauthorizedAccessException during storageFolder.CreateFileAsync

前端 未结 2 445
陌清茗
陌清茗 2021-01-26 16:19

I have the following piece of code

    // Point to c:\\users\\yancheng\\documents\\visual studio 2012\\Projects\\App5\\App5\\bin\\x86\\Debug\\AppX
    StorageFol         


        
2条回答
  •  悲&欢浪女
    2021-01-26 16:59

    You are trying to create a file in the installation folder of the app. This location is a read-only location (see http://msdn.microsoft.com/en-us/library/windows/apps/hh967755.aspx).

    Strangely copying files to this folder and deleting files from it is possible if the app was installed by Visual Studio, what I reported as a bug in Microsoft Connect. All in all Apps should not be able to change any content of the installation folder.

    Apps are only allowed to write to the folders reached through ApplicationData and the KnownFolders. In latter case corresponding capabilities and file types must be declared.

提交回复
热议问题