Hi, I have made a simple package that should overwrite som existing files.
exe, txt and some other files. But it does not overwrite some files, is there a way to force the msi to overwrite the files, even when a versionnumber is lower o a date is newer that the one i try to send out, i guess this is some of the problems why it doesn't overwrite the files.

any tips?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Look into the REINSTALLMODE property... (and the 'a' code)
Answered 11/15/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
I dunno if it works, but in InstallShield 11.50 is there a setting "Always Overwrite" if you right-click a file and select properties.
I have never tried it myself.

/Jonas
Answered 11/15/2005 by: jonasm
Blue Belt

Please log in to comment
0
Thanks for the fast reply, will try your tips.
Answered 11/15/2005 by: painless
Senior Yellow Belt

Please log in to comment
0
painless-
Also check to see that those files are not in use. I have had a couple of packages that have had that problem even when told to overwrite excisting (using WISE any ver.) Have had to delete the files and then copy the new ones over and that usually takes care of it.
-m
Answered 11/15/2005 by: Foleymon
Orange Senior Belt

Please log in to comment
0
Hi,
To replace file fourcefully try using file version in the file table for the files u want to be replaced. As per Windows Installer file-versioning rules, a versioned file will overwrite an unversioned file.

So if the files you want to replace are unversioned then give some version to them and it should replace.

Lillude
Answered 11/15/2005 by: Lillude
Senior Purple Belt

Please log in to comment
0
Hello,

You could try to include the file in the RemoveFile table with InstallMode 1 or 3. On installation, the current file will be removed by the RemoveFiles action, which takes place before the InstallFiles action. Your file will then be installed by the InstallFiles action.

Kind regards,

CS
Answered 11/16/2005 by: cs_m_si
Senior Yellow Belt

Please log in to comment
0
I struggled with this for a long time. The Reinstall mode seemed to force a reinstall of the entire Net 3.5 framework, and I just wanted my application files to be overwritten. I instead used a vbscript to set the file version on all files that need to install each time. Here is a vb script that can be placed in the setup project's post build event to set the version of every file with attribute "512" to the product version. "512" is a file set as vital to your application. Microsoft's sample file versioning vbscript is the base of this program. It still has a few more variables than it needs but will give you the basic idea, and it works.

' Windows Installer utility to report or update file versions, sizes, languages
' For use with Windows Scripting Host, CScript.exe or WScript.exe
' Copyright (c) Microsoft Corporation. All rights reserved. - changed by pepper
' Demonstrates the access to install engine and actions
'
Option Explicit
' FileSystemObject.CreateTextFile and FileSystemObject.OpenTextFile
Const OpenAsASCII = 0
Const OpenAsUnicode = -1
' FileSystemObject.CreateTextFile
Const OverwriteIfExist = -1
Const FailIfExist = 0
' FileSystemObject.OpenTextFile
Const OpenAsDefault = -2
Const CreateIfNotExist = -1
Const FailIfNotExist = 0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1
Const msiViewModifyInsert = 1
Const msiViewModifyUpdate = 2
Const msiViewModifyAssign = 3
Const msiViewModifyReplace = 4
Const msiViewModifyDelete = 6
Const msiUILevelNone = 2
Const msiRunModeSourceShortNames = 9
Const msidbFileAttributesNoncompressed = &h00002000

Dim message1

Dim databasePath : databasePath = "H:\active\claim_master_work\wv2008\cm\ClaimMaster Installation\Release\ClaimMaster Installation.msi"

Dim newVersion : newVersion = ""
Dim console : If UCase(Mid(Wscript.FullName, Len(Wscript.Path) + 2, 1)) = "C" Then console = True
' Connect to Windows Installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
Dim errMsg
' Open database
Dim database, openMode, view, record, updateMode, sumInfo
openMode = msiOpenDatabaseModeTransact
Set database = installer.OpenDatabase(databasePath, openMode) : CheckError
' Create an install session and execute actions in order to perform directory resolution
installer.UILevel = msiUILevelNone
Dim session : Set session = installer.OpenPackage(database,1) : If Err <> 0 Then Fail "Database: " & databasePath & ". Invalid installer
package format"


Dim stat : stat = session.DoAction("CostInitialize") : CheckError
If stat <> 1 Then Fail "CostInitialize failed, returned " & stat
' Get the product version
Dim nametofind : nametofind = "'ProductVersion'"
Dim versionview
Set versionview = database.OpenView("SELECT Value FROM Property WHERE Property = " &nametofind ) : CheckError
versionview.Execute : CheckError
Set record = versionview.Fetch : CheckError
If record Is Nothing Then
message1 = "did not find the product version"
wscript.Echo message1
Else
newVersion = record.StringData(1)
End if
' List all files in the msi package
Set view = database.OpenView("SELECT FileName,FileSize,Attributes,Language,Version,Sequence FROM File " ) : CheckError
view.Execute : CheckError

' Fetch each file and request the source path, then verify the source path, and get the file info if present
Dim fileKey, fileName, folder, sourcePath, fileSize, version, language, delim, message, info
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
' update File table info
If record.StringData(3) = "512" Then
record.StringData(5) = newVersion
End If
view.Modify msiViewModifyUpdate, record : CheckError
Loop

' Commit database in case updates performed
database.Commit : CheckError
Wscript.Quit 0

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Fail message
End Sub
Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub
Answered 01/02/2009 by: kpepper
Yellow Belt

Please log in to comment
0
using Companion Files can also solve your problem
Answered 01/03/2009 by: cygan
Fifth Degree Brown Belt

Please log in to comment
0
Indeed, companion files/parents is a good option if you have a file with a higher version. It could also be done creating a component with a dummy file (empty text for example) and set that file as keypath for the component. Then add the other files to that component. If you have files that install in different directories you have to repeat this for each directory. A simple custom action that copies the file is also a possibility.
Answered 01/05/2009 by: sk
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity