PDA

View Full Version : MoveFile



bruno_k
06-12-2006, 03:00 PM
Has anyone gotten this feature to work? I'm trying to move something like an app.config file and rename it to a different name. The file gets copied during the install, but the move to the new filename never happens.

I'm using an eval version and I'm wondering why this wasn't implemented like the Visual Studio install projects where you can specify the targetFile name.

RobertDickau
06-12-2006, 06:21 PM
What are your settings in the MoveFile table? Does it work (as a test) if you try to copy a different file?

bruno_k
06-13-2006, 09:00 AM
I'm entering:

FileKey: the file's key
Component_: choosing the component from the drop down
SourceName: the name of the source file
DestName: the name the file should become
SourceFolder: the property for folder as found in the Directory table
DestFolder: same as the SourceFolder
Options: 1 for move

Is there anything I'm doing wrong. The file doesn't get moved. I'm basically trying to do a rename.

Thanks.

RobertDickau
06-13-2006, 09:09 AM
As a test, does any other file work?

FileKey: CopyNotepad
Component_: only_component
SourceName: notepad.exe
DestName: copynp.exe|copy of notepad.exe
SourceFolder: WindowsFolder
DestFolder: WindowsFolder
Options: 0

bruno_k
06-13-2006, 12:41 PM
It does work when I use WindowsFolder as the Source and Dest folder, but not a subfolder within the INSTALLDIR, so there must be something wrong there. I am using the Directory value from the Directory table whose parent is INSTALLDIR. Is that the probem?

Thanks

RobertDickau
06-13-2006, 01:13 PM
That could be it; as a further test, does it work if you use INSTALLDIR?

bruno_k
06-14-2006, 08:05 AM
I found out that the move file entry only works if the file is already on the machine before the install. This is why the copy of notepad.exe in the WindowsFolder worked. I can copy files in the INSTALLDIR only if they already exist before my install runs. I thought the MoveFile operation would be able to act on files being installed.

DebbieL
06-14-2006, 08:25 AM
It sounds like that is expected behavior, according to the Windows Installer help. The MoveFiles table is processed by the MoveFiles action, which locates already existing files on the user's computer and moves or copies them to a new location. The MoveFiles action occurs before the InstallFiles action occurs, so the files that your installation is adding are not even present on the machine when the MoveFiles action runs.

Relevant information on MSDN:

MoveFiles Action (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/movefiles_action.asp)
MoveFile Table (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/movefile_table.asp)


Debbie Landers
Macrovision Corporation