WPF XBAP apps and UAC

Here’s an interesting thing I learned the other day, which wasn’t obvious to me.

If you have an XBAP WPF application that tries to access files at the location identified by CSIDL_COMMON_APPDATA (Environment.SpecialFolders.CommonApplicationData in .Net 2.0/3.0) they need to be marked with Read/Write permissions for “Everyone”. Otherwise File Virtualization kicks in and Vista creates copies of the files in the VirtualStore.

This shouldn’t be a problem per se, but if you have data integrity issues with your application reading/writing files it’s nice to eliminate the virtualization for troubleshooting.

Also, if your application needs to share the same data among users you don’t want virtualization, since that is a per-user thing, and you’d end up with one set of data files for each user.

If you’re installing some default data files for the application using Windows Installer (which will run elevated), you need to make sure you change the permissions on the data files so “Everyone” gets read/write permissions. This can be done using the LockPermissions table of Windows Installer.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.