all groups > visual studio .net setup > october 2005 >
You're in the

visual studio .net setup

group:

Problem with overwriting a file on deployment



Problem with overwriting a file on deployment Spaz
10/21/2005 5:36:04 AM
visual studio .net setup: I am using the "Setup Wizard" from the "Setup and Deployment Project".
My installation installs a bunch of binaries along side an existing program
on the users machines. Along with these files I am also installing a
settings.ini file which already exists on the users machine. The problem is
that the settings.ini file does not overwrite the one on the users machine.
If I manually delete the file from the users machine then run the install,
the installation performs as expected. The file that is on the users machine
does not have readonly, archive, system or any other propery set to it. The
properties of the file are:
Condition=
Exclude=False
Hidden=False
PackageAs=vsdpaDefault
Permanent=True 'I need this updated file to stay even if the uninstall is ran
ReadOnly=False
Register=vsdrfDoNotRegister
SharedLegacyFile=False
Transitive=False
Vital=True

I also tried using a custom action, VB Script, in the Install action where I
locate the setting.ini on the users system then rename it. The problem I run
into is:
1)If the file already exists on the users machine - the installation runs,
renames the setting.ini to setting.old and the setting.ini from the install
package does not copy onto the system.
2)If the file is not present - The installation runs, copies the file to the
system, the it gets renamed to settings.old.

Any ideas?


Thanks ,
Re: Problem with overwriting a file on deployment Phil Wilson
10/23/2005 10:35:30 AM
What's happening herer is that Winddows Installer, the MSI engine, will not
replace data files that have differing modify and creation dates. The
assumption is that they've been modified by the user and so shouldn't be
repllaced, that's probably what you're seeing.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/neither_file_has_a_version.asp

The issue you're having with custom actions is that although they're called
"install" custom actions, Visual Studio sequences them pretty much right at
the end of the install when all the files are already installed. It's much
to late to remove a file that you want to remove *before* anything gets
installed.

I don't know of a way you can do this with Visual Studio setup projects.
There's nothing wrong with VS setup projects, it's just they don't offer the
features that lots of other MSI tools do.
http://installsite.org/pages/en/msi/authoring.htm

If you have a launcher program, you could run it to locate and remove the
ini file and then launch your MSI file.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

[quoted text, click to view]

AddThis Social Bookmark Button