KinesisTapMsiCustomAction/CustomAction.cs
/// <summary>
/// Install NLog.xml if not existing. Do not override the existing.
/// </summary>
/// <param name="session"></param>
/// <returns></returns>
Install NLog.xml if not existing. Do not override the existing.
Install NLog . xml if not existing . Do not override the existing .
[CustomAction]
        public static ActionResult InstallNLog(Session session)
        {
            session.Log("Begin installing NLog.xml");
            string installLocation = session.CustomActionData["INSTALLFOLDER"];
            string nlogPath = Path.Combine(installLocation, "NLog.xml");
            if (!File.Exists(nlogPath))
            {
                session.Log("NLog.xml not found. Writing a new NLog.xml.");
                string nlogTemplatePath = Path.Combine(installLocation, "NLogTemplate.xml");
                try
                {
                    File.Copy(nlogTemplatePath, nlogPath);
                }
                catch (Exception ex)
                {
                    session.Log($"Failed to install NLog.xml: {ex.Message}");
                    return ActionResult.Failure;
                }
            }
            session.Log("Finish installing NLog.xml");
            return ActionResult.Success;
        }
[ CustomAction ] public static ActionResult InstallNLog ( Session session ) { session . Log ( " " ) ; string installLocation = session . CustomActionData [ " " ] ; string nlogPath = Path . Combine ( installLocation , " " ) ; if ( ! File . Exists ( nlogPath ) ) { session . Log ( " " ) ; string nlogTemplatePath = Path . Combine ( installLocation , " " ) ; try { File . Copy ( nlogTemplatePath , nlogPath ) ; } catch ( Exception ex ) { session . Log ( $" Failed to install NLog.xml:  { ex . Message } " ) ; return ActionResult . Failure ; } } session . Log ( " " ) ; return ActionResult . Success ; }
Install NLog.xml if not existing.
Install NLog . xml if not existing .
//Need to run InstallAppSettings.SetProperty custom action first to set the value
None
session
Session
None