You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation where i want to invoke the msi installer only once , even if multiple double clicks are done. Is there any Wix-way (wix elements )to do it or i have to write custom actions and use lock ?
I tried creating below custom action but that does not work. CA gets invoked i see in the logs.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace LaunchMutexForInstaller
{
public class CustomActions
{
[CustomAction]
public static ActionResult PerformHoldLock(Session session)
{
bool requestInitialOwnership = true;
Mutex InstallerMutex = null;
try
{
if (Mutex.TryOpenExisting("Installer_Mutex", out InstallerMutex))
{
if(InstallerMutex != null)
{
Environment.Exit(1);
}
}
else
{
InstallerMutex = new Mutex(requestInitialOwnership, "Installer_Mutex");
}
}
catch
{
return ActionResult.Failure;
//Error opening Mutex /IoException or Name is Null
}
return ActionResult.Success;
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a situation where i want to invoke the msi installer only once , even if multiple double clicks are done. Is there any Wix-way (wix elements )to do it or i have to write custom actions and use lock ?
I tried creating below custom action but that does not work. CA gets invoked i see in the logs.
Beta Was this translation helpful? Give feedback.
All reactions