mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

How to modify property values in exe file

Hi ,

I have been using Wix Toolset to create custom Actions. I can easily pass information through properties in Actions (modify property values, read property values). The following is an example of Action.

Code: Select all

[CustomAction]
        public static ActionResult ValidateUserAccountAction(Session session)
        {
            session.Log("Begin ValidateUserAccountAction");
            const string sessionResultName = "USERACCOUNT_VALIDATION_RESULT";

            try
            {
                if (!ValidateUsername(session))
                {
                    session[sessionResultName] = "False";
                    return ActionResult.Success;
                }

                if (!ValidatePassword(session))
                {
                    session[sessionResultName] = "False";
                    return ActionResult.Success;
                }

                session["CREDENTIAL_STRING"] = CredentialFileUtils.BuildUserCredential();
                session[sessionResultName] = "True";
            }
            catch (Exception e)
            {
                session["ACTION_MESSAGE"] = Properties.Resources.StringUnknownError;
                session[sessionResultName] = "False";
                session.Log("ValidateUserAccountAction: " + e.Message);
            }
            finally
            {
                session.Log("End ValidateUserAccountAction");
            }

            return ActionResult.Success;
        }
Recently I have a .NET 7 project and I can no longer use Wix Toolset to create custom Actions because Wix Toolset does not support .NET 7.
So I want to create an exe file based on .NET 7, and contain all the Custom Actions in this exe file. My question is how to read and modify the property values in the Custom Action of this exe?
Catalin
Posts: 6623
Joined: Wed Jun 13, 2018 7:49 am

Re: How to modify property values in exe file

Hello,

Please have a look over our "How to create a .NET Custom Action" which should cover what you need.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

Re: How to modify property values in exe file

Hi Catalin,

My Advanced Installer version is 19.0. I did not find "Call method from .Net assembly" in the custom Action. Are there any other solutions?

Thanks,
Andrew
Catalin
Posts: 6623
Joined: Wed Jun 13, 2018 7:49 am

Re: How to modify property values in exe file

Hello Andrew,

Indeed, we have added this support recently as many clients requested it.
Are there any other solutions?
I'm afraid I am not aware of any other solutions.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”