I need to copy an icon file in C:// drive due to the first run of my UWP FullTrust Application. Here below is my code, which is working properly in Debug mode but not works in Release mode.
var packagePath = Package.Current.InstalledLocation; var srcPath = Path.Combine(packagePath.Path, "Assets\\Systray_icon.ico"); Windows.Storage.StorageFile storageFile = await Windows.Storage.StorageFile.GetFileFromPathAsync(srcPath); Windows.Storage.StorageFolder storageFolder = await Windows.Storage.StorageFolder.GetFolderFromPathAsync("C:\\"); await storageFolder.CreateFolderAsync("MyAppFolder", CreationCollisionOption.ReplaceExisting); Windows.Storage.StorageFolder sf = await Windows.Storage.StorageFolder.GetFolderFromPathAsync("C:\\MyAppFolder\\"); await storageFile.CopyAsync(sf);
The folder has been created in both Debug and Release mode but due to copy throws an exception in release mode.
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Any kind of help will be appreciable. Thanks in advance.
User contributions licensed under CC BY-SA 3.0