Hello Ruben,
Indeed, I was able to reproduce this with your sample project.
However, I noticed that you did not create the classes in the same .cs file.
Can you please create your custom actions in the same file as in the attached example?
With this implementation everything is working as expected.
Code: Select all
namespace MyCustomAction
{
public class CustomActions
{
public static int CustomAction1(string aMsiHandle)
{
MsiSession session = new MsiSession(aMsiHandle);
// Log data passed as action data
string infoMessage = string.Format("User data: \"{0}\"", session.CustomActionData);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
// Get property value
string myProperty = "MY_PROPERTY";
string myPropertyValue = session.GetProperty(myProperty);
// Log property MY_PROPERTY value
infoMessage = string.Format("Property \"{0}\" has value: \"{1}\"", myProperty, myPropertyValue);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
string mySecondProperty = "MY_SECOND_PROPERTY";
string mySecondPropertyValue = string.IsNullOrEmpty(myPropertyValue)
? "Advanced"
: "Installer";
// Set property value
session.SetProperty(mySecondProperty, mySecondPropertyValue);
// Log property MY_SECOND_PROPERTY value update
infoMessage = string.Format("Property \"{0}\" was set as \"{1}\"", mySecondProperty, mySecondPropertyValue);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
MessageBox.Show("Custom Action 1");
return 0;
}
public static int CustomAction2(string aMsiHandle)
{
MsiSession session = new MsiSession(aMsiHandle);
// Log data passed as action data
string infoMessage = string.Format("User data: \"{0}\"", session.CustomActionData);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
// Get property value
string myProperty = "MY_PROPERTY";
string myPropertyValue = session.GetProperty(myProperty);
// Log property MY_PROPERTY value
infoMessage = string.Format("Property \"{0}\" has value: \"{1}\"", myProperty, myPropertyValue);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
string mySecondProperty = "MY_SECOND_PROPERTY";
string mySecondPropertyValue = string.IsNullOrEmpty(myPropertyValue)
? "Advanced"
: "Installer";
// Set property value
session.SetProperty(mySecondProperty, mySecondPropertyValue);
// Log property MY_SECOND_PROPERTY value update
infoMessage = string.Format("Property \"{0}\" was set as \"{1}\"", mySecondProperty, mySecondPropertyValue);
session.Log(infoMessage, MsiSession.InstallMessage.INFO);
MessageBox.Show("Custom Action 2");
return 0;
}
}
}
Hope this helps!
Best regards,
Liviu