Deployment - how to force overwriting of existing files?

chrisbwy

Member
Joined
Aug 15, 2005
Messages
13
Programming Experience
Beginner
Hi All,

How do I force the vb.net windows installer to always install a particular file?

I have a situation where I want to install some text files in certain folders on the target PC. However there is a chance that the user has sometime in the past created one or more of these text files himself. If that's the case then the vb.net deployment project I've created to install the text files will not overwrite any existing files of the same name.

Thought there would be a simple "always install" type property but I can't find it.

Any ideas appreciated.

Thanks

Chris
 
Matbe i'm just looking at this wrong, but it sounds a bit dodgy to me. I would never want to automatically overwrite files on a clients machine, what it if was something important?
 
OK a little more info.

I have an application deployed using Install Shield / VB5 that uses a number of predefined text files to operate ( parameter lists ).

I need to update some of these files without first uninstalling the complete VB5 app.

So now that I'm using vb.net for all new projects decided to write a quick deployment project to just install a few of these updated text files into certain folders.

It works ok on text files that don't already exist on the target PC, but where a text file already exists ( installed by Installed Shield during the original install ) it fails to overwrite that file.

Hope this helps give some more background as to why I want to do it.

Chris
 
chrisbwy, maybe someone at these forum know InstallShield and can answer you on a general basis, but remember this is VB.Net forums not VB-5- (or VB classic as some say now) forums.
 
JohnH - I only mentioned Install Shield / VB5 because they were used to install the original app that installed the text files I want to overwrite.

My question relates to a vb.net deployment project that I want to use to overwrite these text files without first uninstalling the original app.

Chris
 
Sounds much more reasonable. Problem is thats how the .MSI works. I think i'm right in saying that if the modified date is later than the created date, the .MSI will asume that the user has changed some settings and won't want to overwrite the file.
 
vis,

original file installed by Install Shield from vb5 project,

created: 12 May 2004
modified: 22 July 2004

file I want to overwrite it with using vb.net deployment,

created: 12 May 2005
modified: 18 July 2006

Chris
 
I hope i'm right in saying this, but when you install a file with a .MSI it sets the modified and created dates to be the same. It is because your file has been modified that the .MSI won't overwrite the file. As far as i know thats how .MSI works and i don't think there is a way to tell it to do otherwise. Although i do use .Net 1.1. It is possible that there may be an option in .Net 2.0
 
ok, chrisbwy, I saw you mentioned both vb.net windows installer and Install Shield / VB5, sounded a bit confused. You might want to know that the operating system filesystem have no record on where the files came from.

VB2003 Setup Project always overwrite, and I don't see no option to make it not do this, and this is also logical since the application depend upon the files it deploy with, so they need to fully comply with the setup package.

You have to separate application resource files and output data files in the logic. Data files is something you could generate/templates for if they don't already exist. In VB2005 (.Net 2) this is more clear with ClickOnce and application resources. ClickOnce don't allow to deploy additional file structure. The resources are readonly. Use resources to add files etc that the application need for operation. The application may generate data files for output, and data files that application produce is not in conflict with its resources.

Do you mind setting your user profile Primary Platform?
 
JohnH,

Thanks for the info, sorry but I think my novice knowledge cannot keep up with you.

How about if I write a small exe that runs at the start of the Deployment to first delete the out of date text files that I want to update. Then the new ones will be installed because the originals don't exist?

Chris
 
JohnH,
Can't do this - Help states,

"Install Custom actions placed under this node will be executed at the end of the install phase of installation, after all files have been installed."
After the files have been installed.

Any more ideas anybody?

Chris
 
Do you mind setting you Primary Platform?

Forums mainmenu > User CP > Edit profile > end of page is a combobox where you choose you Primary Platform : VB2003/VB2003/VB2005 (alternative .Net 1.0/.Net 1.1/.Net 2.0)

When you now talk about custom action, this could mean VB2002/VB2003 and Setup Project, but then again you could have acquired an Professional edition of VB2005 and trying to do MSI setup, what do I know...

There are lots of things you can do, you made the application and you can do what you want with it. Thought about changing filenames for the new version? Do a migration process for old data? For instance create a migration application that you include in the setup and run in custom action. You can use resource files in earlier versions of VB too, but not that easy to work with.
 
Back
Top