[wix-users] custom action

madhusudhana rao Vadlamuri vadlamuri.madhu at gmail.com
Mon Oct 9 16:38:00 PDT 2017


Hi everyone,

I’ve one  custom CA
CA files look like this:
"namespace WaferVisionCA
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult BackUpFiles(Session session)
        {
            string dataFolder = session["DATA"];
            string backupFolder = @"C:\Backup\WaferVision\" +
DateTime.Now.Month + "-" + DateTime.Now.Date + "-" + DateTime.Now.Year +
"\\";
            string[] backupFilesList;
            try
            {
                if (Directory.Exists(dataFolder))
                {
                    backupFilesList = Directory.GetFiles(dataFolder,
"*.wv");
                    Directory.CreateDirectory(backupFolder);
                    foreach (var file in backupFilesList)
                    {

                        File.Copy(file, backupFolder + new
FileInfo(file).Name);
                    }
                }
                return ActionResult.Success;
            }
            catch (Exception ex)
            {
                session.Log("Could not take the back up : " + ex.Message);
                return ActionResult.Failure;
            }

        }
    }
}"

wix file look like:

<CustomAction Id="BackupFiles" Return="check" Execute="immediate"
BinaryKey="WaferVisionCA.CA.dll" DllEntry="BackUpFiles"/>

<Binary Id="WaferVisionCA.CA.dll"
SourceFile="$(var.WaferVisionCA.TargetDir)$(var.WaferVisionCA.TargetName).CA.dll"/>

<Property Id="DATA" Secure="yes" Value="C:\amat\WaferVision\Data\"/>


-<InstallExecuteSequence>

<Custom After="CostFinalize" Action="BackupFiles"/>

</InstallExecuteSequence>

it able to copy files... and any one can help to create XML file for
installation.

-- 
V.Madhusudhana Rao
Email      : vadlamuri.madhu at gmail.com.


More information about the wix-users mailing list