-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set or use Launchcondition Action in Wix# #1641
Comments
|
thanks for quick answer, oleg. Any idea, how add cancel installation message if conditions are not fullfilled ? |
found it on Load Event and just tested. try
{
var appKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\application").GetValue("ProgramDir").ToString();
if (string.IsNullOrEmpty(appKey))
{
e.ManagedUI.Shell.CustomErrorDescription = "Programm not installed.";
e.ManagedUI.Shell.ErrorDetected = true;
}
e.Session["INSTALLDIR"] = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\applicationRegs").GetValue("ProgramDir").ToString();
e.Session["APPVERSION"] = FileVersionInfo.GetVersionInfo(e.Session["INSTALLDIR"] + "\\app.exe").FileVersion;
Version version = Version.Parse(e.Session["APPVERSION"]);
if (version.Major != 1 && version.Minor != 2)
{
e.ManagedUI.Shell.CustomErrorDescription = "Condition for Installation not fullfilled.";
e.ManagedUI.Shell.ErrorDetected = true;
}
}
catch(Exception ex) <--- This Exception executed.
{
e.ManagedUI.Shell.CustomErrorDescription = "Exception " + ex.ToString();
e.ManagedUI.Shell.ErrorDetected = true;
} i also added extra DefaulDeferedProperty APPVERSION to project.DefaultDeferredProperties = ",APPVERSION"; appears shomehow, only exeception , not Condition for Installation not fullfilled. Versions of exe are not 1.2, but 24.3.15.20511. Any Idea why? also even i remove this code from Load Event - i see nullref exception and msi error 1602 in windows EventLog. Now i curious. 😵💫😵💫😵💫😵💫 |
i think i run in issue. Created new wix Sharp v3 - Custom UI Project. Wait for nuget restore and rebuild project , without changes. Msi is created, but if start it on testsystem appears ************** Exception Text ************** ************** Loaded Assemblies **************
|
i checked my originall project for creation msi. i had added public static class CustomActions
{
[CustomAction]
public static ActionResult SetWVToolDir(Session session)
{
try
{
//x64 - 64 Bit
session["INSTALLDIR"] = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\app").GetValue("ModuleDir").ToString();
string path = session["INSTALLDIR"];
session["DIR2"] = path + @"\Extension\Addins";
return ActionResult.Success;
}
catch (Exception)
{
return ActionResult.Failure;
}
}
[CustomAction]
public static ActionResult SetExtensionManualsDir(Session session)
{
session["INSTALLDIR"] = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\App").GetValue("ModuleDir").ToString();
string path = session["INSTALLDIR"];
session["DIR3"] = path + @"\Extension\Addins\Manuals";
return ActionResult.Success;
}
} this code works for setting installdr property, but on Load Event apears nullreference Exception. Is Load Event broken or something wrong with it ? I invistigate some research further, Looks like in Custom UI Template ResetLayout Method is broken. After i commented in each dialog this method out, now it works. Any recent changes in Custom UI Template ? |
thanks, again. I just checked. VS 2022 doesnt show any Updates for WixSharp Template, i intalled latest template version on my work machine. is this somehow related to changes in #1490 ? |
Yes, it is related. Since it happened a second time I am converting this in the CI defect. In the meantime please use this simple workaround that will be the essence of the future fix. image.Image = Runtime.Session.GetResourceBitmap("WixSharpUI_Bmp_Dialog") ??
Runtime.Session.GetResourceBitmap("WixUI_Bmp_Dialog"); |
morning, i tested recent, 30 min ago, workaround works. Many thanks. |
- Remove Caliburn.Micro dependency for WPF UI - #1638: Simplify Custom UI - #1641: How to set or use Launchcondition Action in Wix# - #1613: Hidden child features in FeaturesDialog.UserSelectedItems - #1604: Some strings in Dialogs from .wxl are not replaced in Custom WPF UI - #1637: Custom WPF FeaturesDialog (possibly default too) non-functional. - Improved VSTemplates. Triggered by #1624 - Updated VS project Templates for supporting Caliburn.Micro removal
- #1638: Simplify Custom UI - removed Caliburn.Micro - #1641: How to set or use Launchcondition Action in Wix# - #1613: Hidden child features in FeaturesDialog.UserSelectedItems - #1613: Hidden child features in FeaturesDialog.UserSelectedItems - #1604: Some strings in Dialogs from .wxl are not replaced in Custom WPF UI - Issue #1561: ComponentIDs for files change depending on folder that source is built from. - fixed problem with `SetShellSize` not setting the top level window size - Added `CommonTasks.MapAsDeferredProperty` extension method
morning, i struggle on create msi, where i can perform launchcondition action after appsearch.
Following scenario : before Plugin starts installation, it should check if mainprogramm installed and if so, check also .exe fileversion if this not versions, comes from me , are not equals cancel installation.
i done some research
WixToolset v4 info : https://wixtoolset.org/docs/schema/wxs/launchconditions/
for any suggestions or code , thanks.
The text was updated successfully, but these errors were encountered: