4

How can I exclude web.config (or app.config) file in visual studio installer if it already exist on target machine (and folder)?

Normally, web.config and app.config file contains configuration information related to the particular customer. If they just install setup, their config files will be overwritten. I want to check for existence of configuration file before overwriting them. If config file is already there, I do not want to overwrite it.

Chintan Shah
  • 373
  • 1
  • 2
  • 16

2 Answers2

6

This is pretty simple. From the installer right click on the content from/primary output from project and there is an option of exclude filter. In that just create a new filter and add the files you want to exclude.Then you are done.

Now check your folder where you have installed and you will not find the excluded files there.

For more :http://dataerror.blogspot.in/2010/06/creating-web-setup-project-for-aspnet.html

Hope this helps you.

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
  • I'm not sure this covers everything. What if you want to preserve a previously existing config but want the config file to copy to the app folder for fresh new installs? I would think an exclude filter would prevent the config file from being copied in both cases. – Jeff LaFay Oct 30 '12 at 14:21
1

You can use searches to determine if the files already exist, and then condition the installation of the components that contain the files in the package

Ciprian
  • 3,533
  • 1
  • 18
  • 22