Search code examples
visual-studio-2010setup-projectvisual-studio-setup-proje

VS2010 Setup Project force overwrite of files


Looked everywhere and it seems like in VS2010 all options have been removed to do this.

I have a Setup Project that has Application Files that get copied over to the Application folder. What I want is to be able to overwrite any existing files there. The end user may edit this files between updates and I need to be able to overwrite their changes as well as send them any updates to these files.

Setting folders to "CreateAlways=True" does NOT mean the folder contents are overwritten as I had hoped/expected. It only allows you to create empty folders.

I've tried this solution. And apparently that doesn't work with 2010.

Easiest thing I can think of is to be able to set version numbers on these files to force the installation rule to overwrite older versions, but I don't think that's possible on text files and the like. (Besides, it's many files and I do updates often)


Solution

  • The most used approach (and easiest) is to set a very high version for all rows in File Table. For example you can use:

    65535.65535.65535.65535
    

    This could be done through a script or EXE which opens the MSI database, modifies it and saves the changes. You can find the MSI database API here: http://msdn.microsoft.com/en-us/library/aa368250(VS.85).aspx

    Please note that some commercial tools have a special options for this.