Use ApplicationData.Current.LocalFolder.Path , not Package.Current.InstalledLocation.Path
string documentsPath = ApplicationData.Current.LocalFolder.Path; System.Threading.ManualResetEvent mre = new System.Threading.ManualResetEvent(false); Task.Factory.StartNew(async () => { await ApplicationData.Current.LocalFolder.CreateFolderAsync("Data"); mre.Set(); }); mre.WaitOne();
Package.Current.InstalledLocation.Path gives you a way where all of your code and resources work with the visual studio debugger, which is usually the debug folder for the source code. This is not available through the UWP API libraries that are commonly available in .NET applications (win32).
The UWP application has read / write access to the folder " C: \ Users \ {userprofile} \ AppData \ Local \ Packages \ {packagenameguid} \" . You can create the folder / files in this place at the runtime of applications.
source share