Here is my code to fill my session in ManagedUI from:
void next_Click(object sender, EventArgs e)
{
MsiRuntime.Session["PASSWORD"] = password.Text;
MsiRuntime.Session["DOMAIN"] = domain.Text;
Shell.GoNext();
}
and here is my CustomAction:
public class CustomActions
{
[CustomAction]
public static ActionResult InstallService(Session session)
{
MessageBox.Show(session["Password"]); // always shows an empty message
return ActtionResult.Success;
}
...
I still haven't figured it out what's wrong with my code? I have populated the data into the session but I can't access it in CustomAction.
You need to send your objects thru command promp.For example :
using (var p = new Process())
{
var info = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = @"C:\Windows\System32\cmd.exe",
Arguments = string.Format("/c msiexec /i \"{0}\\{6}.msi\" PATHNAME=\"{0}\" SSLCERTPATH=\"{1}\"" +
" MSINEWINSTANCE=1 TRANSFORMS=\":{2}\" USERPATH={3} ENVIRONMENTPATH={4} SSLCERTPASS=\"{5}\" /L*v \"{0}\\{6}Log.txt\""
, XmlSettings.EnvironmentFolderPath, FindCertificates.SslCertPath, environment, XmlSettings.IisUserFolderPath,
XmlSettings.EnvironmentFolderPath, FindCertificates.SslCertPass, msiName),
UseShellExecute = false,
CreateNoWindow = true
};
p.StartInfo = info;
p.Start();
p.WaitForExit();
}
Then in your wxs project :
<Property Id="SITEPHYSPATH" Hidden="yes"/>
<Property Id="USERPATH" Hidden="yes"/>
<Property Id="ENVIRONMENTPATH" Hidden="yes"/>
<Property Id="THUMBPRINT" Hidden="yes"/>
<Property Id="PATHNAME" Hidden="yes" />
Last set your objects in the custom action:
var thumbprint = session["THUMBPRINT"];