Wix Copyfile and components order - wix

I'd like to move some files from where the directory is installed to a second location with a MSI.
I created a component that refers to the second directory and added there the CopyFile element:
<CopyFile Id="copy" DestinationProperty="AUSTORAGE" SourceProperty="PFSTORAGE" SourceName="*.*" Delete="yes" />
It doesn't seem to copy anything but after taking a look at the logs its seems like the component that copy the files is executed before the files are copied to the first directory during the installation.
Is there any way to control the secuence of the components? Or any better aproach to copy the files (all the files in a directory)?

Just move your CopyFile element under the File element (the file you'd like to copy after it is installed), and it will appear in the right order. The point here is the DuplicateFile table functionality (the one Ciprian mentions here) is also included into the CopyFile element logic. See CopyFile element help for more details.

You cannot use a CopyFile operation because the MoveFiles action (which copies the files) comes before the InstallFiles action durring install.
Please take look at the DuplicateFile table which will copy files after the files are deployed.
http://msdn.microsoft.com/en-us/library/aa368335(VS.85).aspx

Related

Is there a built in way to hide a file in Wix?

The company I work for has recently taken to generating MSI files with Wix. We're at the tail end of the process, but there's one more thing they need me to do.
We have an XML file with a snapshot of what binaries have gone into the install. However, the customers we deliver to will get somewhat confused about an extra useless file in the install.
Most everything that comes up when I search for 'Wix' and 'hide file' is focused on removing or deleting the files after install. I just need to hide this sucker though.
Is there a way to hide the file through HEAT or something? I can modify the file element in the WXS using XSL or Powershell if need be. Or do I need to resort to a custom action that calls cmd.exe to hide it?
You can try setting the file element's hidden attribute to yes. Taken from here:
Set to yes in order to have the file's hidden attribute set when it is installed on the target machine.

How can I change the text in the Wix installer dialog?

My text message is stuck to "Install My Product to:"
How can I change this?
("My Product" is the name of my product and the string above is resolved based on the Name attribute in my Product.wxs).
I have 2 dialogs and the second requires a different message.
Some text on the built-in dialogs can be changed with variables specified in the localization file for your language. This is a simpler task than if you are trying to change text that is not kept in a variable.
This process is documented here.
However, if that's the case, the recommended way to change the dialog on the install page is to make a copy of and change the template file(s) provided with the WiX installation.
Copy the relevant .wxs files from your WiX dialog extension set (you will need to make sure you installed the WiX source) you want to modify and copy the file that specifies the UI extension name. Modify it to suit your needs and change the names.
When you compile your installer, you will use your new extension name (referring to your modified dialog set) and tell candle/light where your modified .wxs files are.
This process has some good documentation here and here.
Following the entire tutorial at the second link should get you pretty far.
Good luck

How to get the value of INSTALLDIR in wix

Am copying files to INSTALLDIR using wix. And how do i get the path of copied file location. I want to use the value(path) of INSTALLDIR.
Thanks in Advance
Using [INSTALLDIR]. Directories with capital letters also act as property.
If you can use VbScript Custom Actions, then you can try this:
Msgbox Session.Property("INSTALLDIR")

NSIS doesn't backup all files

An NSIS installer creates a fairly large folder structure. When the installer starts, it checks the registry to see if there is a current version installed...
Then it asks if you want to make a backup of the current folder.
It works most of the time, but sometimes when it is backing up older versions, instead of copying over the entire directory, it only copies the icon.
!insertmacro un.MoveFolder "$INSTDIR" "${BACKUP_FOLDER}" "*.*"
Reference: http://nsis.sourceforge.net/MoveFileFolder
!insertmacro MoveFolder "$INSTDIR\[path\]source-folder[\]" "$INSTDIR\[path\]destination-folder[\]" "file-mask"
Afterwards, it moves on to the delete section...
Could it be that it doesn't have time to do it ? it starts the next process before finishing the move ?
What else could be going on so that it does not copy the entire folder ?
During the installer, I see
Create folder c:\backup_folder
Moving files: c:\current_folder\*.* to c:\backup_folder\
Delete file: c:\current_folder\file1.........
And at the end, backup_folder has only the icon (not all the files)
Edit: The solution - please see my post here NSIS difficulty moving folders - $INSTDIR is indeed a special folder so I had to move the uninstaller to a $TEMP folder.
Is there any reason why you cannot use the built-in CopyFiles command?
To debug this I would suggest that you add a DetailPrint near the top of the .MoveFolder_Locate_moveFile function. If you see all the file names go by then the problem is the move operation in that function, if not then the problem is in the ${Locate} macro used by this code.
Another alternative is to watch the filesystem operations with Process Monitor...

Copy files from Setup location to installation dir

I am working on my Wix project and have 2 questions:
1) How can I copy file from the same location as my .msi is to the destination folder specified during installation. This file is not part of .msi package but a customized file that needs to be copied after the installer copies the main code files.
2) If this customized file is not available at the location where .msi file is, then I need to show up a OpenFile Dialog so that user can specify the location of this file.
In short, by default the installer should look for the customized file at the same location where the installer is and if the file is not available then show OpenFile Dialog.
Any suggestion or sample code snippet would be very helpful as I am bit new to WIX world.
Thanks for your time.
Ok, first thing you should find out if the file is there. Use DirectorySearch/FileSearch elements for this.
Next, based on the file search result (it will end up in a certain property) schedule and condition a new dialog. You can find how to customize your dialog UI sequence here.
And finally, use CopyFile element to do the copy work.