Visual Studio 的安装项目

发布于 2024-10-03 13:12:00 字数 193 浏览 2 评论 0原文

如果我右键单击安装项目并转到“用户界面”。

我们将看到“开始”。如果我右键单击并选择“添加对话框”

在添加对话框中,选择“客户信息”

如果我转到“客户信息”的属性,则会有一个名为“序列号模板”的选项卡。

是检查程序安装时输入的号码是否正确。

我不知道它是如何工作的。

有人吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

过期情话 2024-10-10 13:12:01

上面的答案并没有说明如何自定义序列号验证,毕竟如果只输入序列号而不验证是没有意义的。

我们必须在自定义操作的 CustomActionData 属性中添加以下文本:

/PIDKEY = [PIDKEY]

然后您可以使用下面的代码来获取并验证自定义操作项目中输入的序列号:

字符串序列 = Context.Parameters ["PIDKEY"]

相关链接:

http://msdn.microsoft.com/en-US/library/vstudio/8z9h65a3(v=vs.100).aspx

http://msdn.microsoft.com/en-US/library/vstudio/aa370826(v=vs. 100).aspx

如何构建自定义操作项目:

http://msdn.microsoft.com/en-US/library/vstudio/d9k65z2d(v=vs.100).aspx

Above answers did not explain how to customize the serial number verification, after all, it is meaningless if you just enter the serial number but does not validate it.

We must add the following text at CustomActionData property of Custom Action:

/ PIDKEY = [PIDKEY]

You can then use below code to obtain and verify the serial number of input in Custom Action Project:

string serial = Context.Parameters ["PIDKEY"]

Related links:

http://msdn.microsoft.com/en-US/library/vstudio/8z9h65a3(v=vs.100).aspx

http://msdn.microsoft.com/en-US/library/vstudio/aa370826(v=vs.100).aspx

How to build a Custom Action Project:

http://msdn.microsoft.com/en-US/library/vstudio/d9k65z2d(v=vs.100).aspx

不离久伴 2024-10-10 13:12:00

我实在不知道你的问题是什么。 是的,“序列号模板”允许您向安装程序添加一个表单,用于验证用户是否输入了有效的序列号以及安装是否有权继续进行。

它提供了基本内容屏蔽编辑控件,允许您定义应用程序接受的序列号格式。您指定一个模板,该模板定义序列号被视为有效所需的字符模式。该模板用于在对话框上排列这些文本框以及进行验证。 (请参阅 MSDN 上的文档。)

以下字符被接受为模板的一部分以及您输入的任何其他字符都将被视为文字:

#  需要一个不会包含在验证算法中的数字。

%  需要一个数字,该数字将是
包含在验证算法中。

?  需要字母数字字符
则不会被包含在
验证算法。

^  需要大写或小写
特点。数字不是数字
此处有效。

<  左边的任何字符
该字符在以下位置不可见
对话框。

>  右边的任何字符
该字符在以下位置不可见
对话框。需要作为
终止符如果<使用字符。

如上所示,在模板中指定带有 % 的数字表示应根据 Windows Installer 验证算法对它们进行检查。这实际上是将所有检查的数字相加并除以七。如果余数为零,则该数字有效;否则,就不是。这不是一个特别强大的安全措施,因为该算法非常知名,但它提供了一种简单的方法来减少用户输入序列号时出现转录错误的可能性。

例如,如果您使用模板 <###-%%%%%%% - FOO - %%%>,您将看到以下对话框:
示例安装程序对话框,验证序列号

(无耻地从 Griffiths 的掌握 Visual Studio .NET 中盗用,等)

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.)

倒数 2024-10-10 13:12:00

该特定设置的文档位于 http://msdn.microsoft.com/en- us/library/w3xwh311.aspx

有关验证序列号的(有点旧)知识库文章位于 http://support.microsoft.com/kb/253683/en-us

Documentation for that particular setting is at http://msdn.microsoft.com/en-us/library/w3xwh311.aspx

A (somewhat old) knowledge base article on validating serial numbers is at http://support.microsoft.com/kb/253683/en-us

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文