Forum Discussion

JohnMcC1983's avatar
JohnMcC1983
Copper Contributor
Feb 02, 2024

Program updates cant access appdata files

Hello.

My program is installed via an appinstaller downloading an msixbundle. 
I have assigned a protocol to the app in the AppxManifest so that it can accept parameters when launched through a command line.  On first start up I send data into the program which it stores in the user appdata folder.  I have tracked file to C:\Users\My.USer\AppData\Local\Packages\My-App-Identifier\LocalCache\Roaming\MyApp\Myfile.xml
When the program starts up subsequently is can access this file and read the contents with no issues.

I have just compiled a new version of the same code and released the next version of the msixbundle.
The program has updated without issue on the targeted PC.  However this time when the program starts up I get a read error when the program is trying to read Myfile.xml

 

I have checked and can still see the file in the path above.  I can also access it through notepad.

Has anyone come across this before?  Is there some setting to allow access to be updated along with the version installed?

 

Many thanks in advance

  • JohnMcC1983's avatar
    JohnMcC1983
    Copper Contributor
    Figured out the problem. When I write the file for the fist time I need to point to a folder in the WindowsApps folder. so it has an entry c:\Program Files\WindowsApp\AppFolder_1.0.0.0\RequiredFolder
    When I upgrade the program to version 1.0.0.1 this path becomes obsolete.
    I quick change to code to update the path to the correct version and everything has kicked back into life 🙂

Resources