Answer
You need to modify some of that
file's component attributes, in the "Organization" page.
- to prevent it from being repaired check the "Never Overwrite" attribute
- to prevent it from being uninstalled check the "Permanent" attribute
However, this method has some drawbacks. By using it, that file has to be manually repaired or deleted by the user if it gets corrupted.
If you already released a version without using these options and want to prevent a file from being uninstalled you could use this method.
As a general idea, it is not recommended to use the installed file to store any user data. The best way would be for the application to create a new file that stores it. At the simplest form, this method would consist of simply creating a copy of the installed file and modifying that.
If the application cannot create the file from scratch it should use the installed file as a template for the files that store the user data, meaning that the application uses the installed files as a starting point. It merges the user data with the template data to create the new file.
Topics
- Preserve File on Install
How to prevent a file of an older version of the application from being uninstalled and replaced when a newer version is installed. - Preserve registry key at install
How to prevent a registry key from being overwritten by a newer version of the package.