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