Hi,

I have a property being set to 0 at start in product.wxs
<Property Id="DATABASE_CREATE_SCHEMA" Secure="no" Value="0"/>

In a C# custom action I set it to 1:
SetSessionProperty(session, "DATABASE_CREATE_SCHEMA", "1");

where SetSessionPropertyis:
 private static void
SetSessionProperty(Microsoft.Deployment.WindowsInstaller.Session session,
string propertyName, string value)
        {
            try
            {
                session[propertyName] = value;
           }
            catch (Exception ex)
            {
                WriteErrorLogInstall(session, "Exception when executing
SetSessionProperty.", ex, true);
            }
        }
the above is done during the "dialog" viewing stage...

I call this custom action:
<Custom Action="CA_CreateTitusDatabase" After="PublishProduct">NOT
Installed</Custom>
    </InstallExecuteSequence>

in another custom action (same C# custom action dll) I read the property:
string createDatabaseSchema = GetSessionProperty(session,
"DATABASE_CREATE_SCHEMA", true);
MessageBox.Show("DATABASE_CREATE_SCHEMA is: " + createDatabaseSchema);

where GetSessionProperty is:
private static string
GetSessionProperty(Microsoft.Deployment.WindowsInstaller.Session session,
string propertyName, bool isCustomActionData)
        {
            string sessionProperty = "";

            try
            {
                if (isCustomActionData)
                {
                    sessionProperty =
session.CustomActionData[propertyName];
                }
                else
                {
                    sessionProperty = session[propertyName];
                }
            }
            catch (Exception ex)
            {
                WriteErrorLogInstall(session, "Exception when executing
GetSessionProperty.", ex, true);
            }
            return sessionProperty;
        }

The messagebox returns a blank value, meaning the property isn't being set
properly or read in properly?

Anybody know why?

Steve





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/MSI-property-not-being-read-in-via-custom-action-tp7580545.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to