Search code examples
visual-studioinstallationwindows-installersetup-projectsetup-deployment

Setup Project for Visual Studio


If I right click the setup project and go to "User Interface".

We will see "Start". if I right click and choose "Add Dialog"

At Add Dialog, Choose "Customer Information"

If I go to the properties of "Customer Information", there is a tab called "Serial Number Template".

It is to check whether the correct number is typed in when the program is installed.

I m not sure how does it work.

Anyone?


Solution

  • I don't really know what your question is. Yes, the "Serial Number Template" allows you to add a form to your setup program that verifies whether the user has entered a valid serial number and if the installation is authorized to proceed.

    It provides what is essentially a masked edit control that allows you to define the format of serial numbers that your application accepts. You specify a template that defines the pattern of characters required for the serial number to be considered valid. The template is used to arrange these text boxes on the dialog as well as for validation. (See the documentation on MSDN.)

    The following characters are accepted as part of the template, and any other characters that you enter are treated as literals:

    #   Requires a digit that will not be included in the validation algorithm.

    %   Requires a digit that will be included in the validation algorithm.

    ?   Requires an alphanumeric character that will not be included in the validation algorithm.

    ^   Requires an uppercase or lowercase character. Numeric digits are not valid here.

    <   Any characters to the left of this character will not be visible in the dialog box.

    >   Any characters to the right of this character will not be visible in the dialog box. Required as a terminator if the < character is used.

    As shown above, specifying digits with a % in the template indicates that they should be checked against the Windows Installer validation algorithm. This essentially adds up all of the checked digits and divides them by seven. If the remainder is zero, the number is valid; otherwise, it is not. This is not a particularly strong security measure, as the algorithm is quite well-known, but it provides an easy way to reduce the chances of a transcription error when the user types in a serial number.

    For example, if you used the template <###-%%%%%%% - FOO - %%%>, you would get this dialog: Sample installer dialog, verifying a serial number
    (shamelessly stolen from Mastering Visual Studio .NET by Griffiths, et. al.)