musada1400
Posts: 2
Joined: Thu Dec 02, 2021 4:37 am

Create Dll Serial Validation Using C#

Hi , How To Create Dll Serial Validator in C#?
Liviu
Posts: 1042
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Create Dll Serial Validation Using C#

Hello and welcome to our forums,

If you want to use a DLL developed in .NET make sure you are using Wix > DTF. Here is our article about How to create fully fledged C# custom actions.

Also, you can take a look on our Serial Number Validation DLL article.

Hope this helps! If you have any other questions, please don’t hesitate to contact us.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
musada1400
Posts: 2
Joined: Thu Dec 02, 2021 4:37 am

Re: Create Dll Serial Validation Using C#

I Need A dll for Licencing > User Defined Validation


I used Wix Project And I Created A Custom Action like this

Code: Select all

        [CustomAction]
        public static ActionResult CustomAction1(Session session)
        {
            
            session.Log("Begin CustomAction1");
            //var enteredSerialNumber = session["PIDKEY"].ToString();
            //session.Log(enteredSerialNumber);
           
            return ActionResult.Success;
        }
        
I Choosed The Dll And I see CustomAction1 But After Run Nothing Happend
Liviu
Posts: 1042
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Create Dll Serial Validation Using C#

Hello,

Please have a look on the following code example:

Code: Select all

namespace SerialValidation
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult CustomAction1(Session session)
        {
            if (session["PIDKEY"] == "111")
            {
                session["SERIAL_VALIDATION"] = "TRUE";

                return ActionResult.Success;
            }
            else
            {
                session["SERIAL_VALIDATION"] = "FALSE";

                return ActionResult.Success;
            }
        }
    }
}
You need to set the property and then use that property in your application. For example condition the next dialog to be visible only if the serial validation from the DLL is true:
validation.png
validation.png (103.5 KiB) Viewed 3063 times

For more details please have a look on these articles:

1. Developing a DLL for serial number validation - here you also have a Serial Number Validation DLL Sample Project.
2. Package Serial Validation.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”