Raj
Raj

Reputation: 2920

Visual Studio: How to protect file from removal on uninstall

Folks, I am creating an installer project in Visual Studio. This is done using a project of type "Setup and Deployment".

I lay out the file structure of my final install in the "File System" View of the project.

Now, some of the files I create as part of my install are updated while my application is used. I would like these files to not be removed during an uninstall of my application. Is there any way in Visual Studio to designate a file as "protected from uninstall"?

Thanks for your help.

Upvotes: 1

Views: 200

Answers (2)

Windows programmer
Windows programmer

Reputation: 8065

In the Solution Explorer window, in the Setup project, click the file. Then in the Properties window, set the Permanent property to True.

Upvotes: 1

Andy White
Andy White

Reputation: 88345

I'm not sure how to do it in the installer, but any file that you create from the application will be preserved in the event of an uninstall.

If you can stand it, maybe you could create these files as a first-time initialization in your application.

Of course, this can lead to other problems (permissions to create a file), but it might be easier than fighting with the cryptic installer setup.

Upvotes: 0

Related Questions