Answer from MSDN by User Heath8041:
用户Heath8041从MSDN回答:
Sneaky Way to get an EULA displayed for your clickonce application in VS2005
Sneaky方法在VS2005中为您的clickonce应用程序显示EULA
Here's a round about way to get your clickonce applications to install with an End user license agreement. Basically you build a redistributable component that can be seen in your prerequsites dialog box under the publish window. This allows a nice way to have all your apps reuse the same agreement, if you want. It's very easy, you need only to create three files ("eula.txt", "product.xml", and "package.xml") and two folders in this case ("EULApackage", and "en"). I documented everything below on how I set mine up. it works great. the only thing you'll have to change is the Name of the component and of course you'll need your own end user licence agreement saved as eula.txt. The component needs to be put in the following path: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages in this folder you should see some sub folders for other redistributable components. First make a new sub directory for your component. I called mine EULApackage. in this new folder you need the following. -A file called product.xml and a sub folder called "en" (for english) you can do various things with the product.xml file, but here's the way mine looks
以下是关于使用最终用户许可协议安装clickonce应用程序的方法。基本上,您构建了一个可再发行组件,可以在发布窗口下的prerequsites对话框中看到。如果您愿意,这可以让您的所有应用重用相同的协议。这很简单,你只需创建三个文件(“eula.txt”,“product.xml”和“package.xml”)和两个文件夹(“EULApackage”和“en”)。我在下面记录了我如何设置我的一切。它很棒。您唯一需要更改的是组件的名称,当然您需要将自己的最终用户许可协议保存为eula.txt。该组件需要放在以下路径中:C:\ Program Files \ Microsoft Visual Studio 8 \ SDK \ v2.0 \ BootStrapper \ Packages在此文件夹中,您应该看到其他可再发行组件的一些子文件夹。首先为组件创建一个新的子目录。我打电话给我的EULApackage。在这个新文件夹中,您需要以下内容。 - 一个名为product.xml的文件和一个名为“en”的子文件夹(英文版),你可以使用product.xml文件做各种事情,但这是我看起来的方式
*in this case the file eula.txt was the text file that was my license agreement. Note that it's not an rtf file. Rtf won't display propertly using this method.
*在这种情况下,文件eula.txt是我的许可协议的文本文件。请注意,它不是rtf文件。 Rtf不会使用此方法显示属性。
Now inside my "en" subfolder i put the eula.txt file and another xml file called package.xml, again this xml file can be used to do all kinds of stuff
现在在我的“en”子文件夹中,我将eula.txt文件和另一个名为package.xml的xml文件放在一起,再次将此xml文件用于执行各种操作
heres the contents of my version*
继承我的版本内容*
Texas Instruments End User License Agreement
en
User Failed to Accept Texas Instruments End User License Agreement.
A fatal error occurred during the installation of ELUA Component Execution
You do not have the permissions required to install this application. Please contact your administrator.
Note: whatever you put in the DisplayName field is what your user will see when he's confronted with the eula text If you have all this put together correctly and in the right folders, the next time you start up VS2005 and go to your publish tab -> prerequisites you should see the DisplayName field. Just check this as a prerequisite for you app. when the user clicks install on the publish.htm file it'll present the user with the conents of your eula.txt file inside of a standard license acceptance dialog box. if the choose accept your stuff installs, if they decline then it exits rather nicely and nothing is installed on their systems. If you mess up the formatting for either of the two files or if you leave out the "en" sub folder then the component won't show up in the prerequisites dialog (when publishing)
注意:您在DisplayName字段中放置的内容是您的用户在面对eula文本时会看到的内容如果您将所有这些放在正确的文件夹中并在正确的文件夹中,则下次启动VS2005并转到发布选项卡时 - >先决条件,您应该看到DisplayName字段。只需将此作为您应用的先决条件。当用户单击publish.htm文件上的install时,它将向用户显示标准许可证接受对话框中的eula.txt文件的标记。如果选择接受你的东西安装,如果他们下降然后它退出相当不错,他们的系统上没有安装任何东西。如果您弄乱了两个文件中的任何一个的格式,或者如果省略“en”子文件夹,则组件将不会显示在先决条件对话框中(发布时)
Additional notes: although this works great it is a round about method and their are ways around the eula, such as if your publish.htm file allows them to run the application directly (I guess without the bootstrapper starting)but if they click the install button it will run. This also has the benifits of not running every time you publish an update to your clickonce application. They have to run the boot strapper to get the eula to show up (by clicking the install button on publish.htm) I figured out this method by looking at some of the other redistributable components that were already in the path C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages. You can look in those other components product.xml and package.xml files to see what cool things they've done with them. Good luck
附加说明:虽然这很好用但它是一个圆形的方法,它们是eula的方法,例如,如果你的publish.htm文件允许它们直接运行应用程序(我猜没有启动引导程序),但如果他们点击安装按钮它会运行。每次向clickonce应用程序发布更新时,这也具有不运行的优点。他们必须运行引导过滤器以显示eula(通过单击publish.htm上的安装按钮)我通过查看已经在路径C:\ Program Files中的一些其他可再发行组件来找出这个方法\ Microsoft Visual Studio 8 \ SDK \ v2.0 \ BootStrapper \ Packages。您可以查看其他组件的product.xml和package.xml文件,看看他们用它们做了什么很酷的事情。祝好运