1
votes

I've got an UWP app which I deploy to Windows 10 IoT running on a Raspberry Pi. This used to run fine, but these last few days (probably after updating something), subsequent deployments will clear out all of the files in the LocalState folder. Actually, all files seem to be cleared.

I checked the project settings (even though nothing has changed there, but ok) and verified the following:

  • The checkbox for "Uninstall and then re-install my package." is unchecked.
  • The checkbox for "Keep all files on device - even those that are no longer a part of your layout" is checked.

These files are being written by the application itself, so upon first deployment there's nothing there. But between deployments I want them to persist (contains configuration style data). With "deployment" I mean just pressing F5 in Visual Studio and deploying to a remote machine (the Pi).

It's probably something stupid, but I can't figure out why it's behaving the way it does.

1

1 Answers

1
votes

That's a very good catch.

Though the root cause is yet unclear to me, what I found so far is that,

  1. If you have vs.appxrecipe file exist in "Layout Folder Path" before debugging, your local application folder data will be persisted.
  2. Otherwise, your local application folder data will be removed.

So a workaround for now is to manually make a copy of vs.appxrecipe, and always copy it to Layout Folder Path before debugging.

I tried to do it in the Build Event command line, either Pre-build or Post-build event,

xcopy /Y "$AppxrecipeFolderPath\vs.appxrecipe" "$LocalApplicationFolder"

However, it's not always working because if your project is up-to-date, the build events won't be triggered at all.