public static string GetPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string featureName, bool tryWithoutFeature) { string featurePropName = propName; if ( !string.IsNullOrEmpty(featureName) && // if belongs to a feature propName.Equals(propName.ToUpper()) // if it is a public property (upper case) ) { featurePropName = string.Format("{0}_{1}", propName, featureName); } Func <string, string> valueGetter = (name) => { if (session.IsInDeferredMode()) { return(session.CustomActionData[name]); } else { return(session[name]); } }; var ret = valueGetter(featurePropName); if (string.IsNullOrEmpty(ret) && !featurePropName.Equals(propName)) { ret = valueGetter(propName); } return(ret); }
public static void SetPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string propValue) { if (session.IsInDeferredMode()) { session.CustomActionData[propName] = propValue; } else { session[propName] = propValue; } }