问题
My WiX installer UI is getting error while using the Custom Action. Interesting part is, the installer is working fine in Windows 10 but while launching it on Windows 7, installer is getting interrupted.
From the installer logs, the error code is displayed 2896
.
Googling further the error code, pointed me that it could be the mismatch of .net framework version. So I modified my CustomAction.config
as follows :
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v3.0" />
<supportedRuntime version="v3.5" />
<supportedRuntime version="v2.0.50727"/>
</startup>
I verified the installed version through using following command :
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"
is there something else am I missing here ?
EDIT: Here is the custom action code for your reference :
namespace ValidateIP
{
public class CustomActions
{
[CustomAction]
public static ActionResult ValidateIP(Session session)
{
session.Log("Begin ValidateIP");
if (string.IsNullOrEmpty(session["IPVAL"]))
{
session["VALIDIP"] = "0";
}
else
{
session["VALIDIP"] = "1";
}
return ActionResult.Success;
}
}
}
回答1:
So it turns out that although I was using the different .Net version in my CustomAction.config file, but in Custom Action project the targeted .Net version was 4.5. So it was superseding the config properties. Once I reduced it to 3.5, it started working. Thanks everyone for all the suggestion.
回答2:
I am not an expert on managed code custom action, Chris Painter is the man for this, but let me check a couple of things:
- Does this custom action require admin rights?
- If it does, is it configured as a deferred mode custom action run in system context?
- In what sequence is the custom action running? GUI? Execute? Both?
- What is the custom action actually doing?
- What .NET classes and .NET features and Widows features does the custom action depend on? (for all we know you could be instantiating COM servers for example)
Verbose, debug, logging: See installsite.org on logging. From that content, I would try:
msiexec.exe /i C:\Path\Your.msi /L*vx! C:\Your.log
This is full, verbose logging (*v
) with extra debugging information (x
) and continuous logging (!
) (as opposed to writing the log in batches). The latter makes the install much slower, but assures that no log-buffer is lost due to crashes.
Some Links (for safekeeping):
- Error 2896 using a WiX C#/.NET 4 custom action
来源:https://stackoverflow.com/questions/50250509/simple-wix-custom-action-in-custom-ui-ends-prematurely-with-windows-7