Simple WiX Custom Action in Custom UI Ends Prematurely with Windows 7

一个人想着一个人 提交于 2019-12-13 00:19:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!