如何动态设置 MSI 安装文件夹
我正在使用 WiX 创建一个 Web 应用程序安装程序。我希望允许用户从 IIS 服务器上的站点列表中选择网站,然后将该应用程序安装在该网站根文件夹的子目录中。
我已经完成了“选择网站”部分。我有一个自定义操作,可以根据所选站点设置一堆属性。这些属性之一 (WEB_SITE_ROOT_PHYSICAL_PATH) 是网站根文件夹的路径。
但是,我无法将应用程序安装到该路径。
我的目录结构如下:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="IIS_WEB_ROOT">
<Directory Id="WEB_SITE_ROOT" Name=".">
<Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
IIS_WEB_ROOT 定义为:
<Property Id="IIS_WEB_ROOT">
<RegistrySearch Id="Search" Root="HKLM" Key="Software\Microsoft\InetStp" Name="PathWWWRoot" Type="raw" />
</Property>
WEB_SITE_ROOT_PHYSICAL_PATH 设置为 WEB_SITE_ROOT,如下:
<Property Id="WEB_SITE_ROOT_PHYSICAL_PATH" Value="WEB_SITE_ROOT"/>
在安装文件夹对话框之前显示网站选择对话框。安装文件夹对话框使用以下“标准属性”:
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
所有这一切的结果是应用程序安装到 IIS Web 根文件夹中,而不是网站根文件夹中。
我只是不确定如何将安装文件夹设置为动态定义的 WEB_SITE_ROOT_PHYSICAL_PATH 属性。我需要一些正确方向的指示。设置 WEB_SITE_ROOT_PHYSICAL_PATH 属性后,是否需要另一个自定义操作来设置安装文件夹?如果是这样,如何在网站选择对话框完成后将其设置为第一个?或者,我已经得到了所有部件,但我只是没有正确连接它们。
I'm creating a web application installer using WiX. I want to allow the user to select the web site from a list of sites on the IIS server, and then install the app in a sub-directory of that web site's root folder.
I've finished the "select web site" portion. I have a custom action that sets a bunch of properties based on the selected site. One of those properties (WEB_SITE_ROOT_PHYSICAL_PATH) is the path to the web site's root folder.
However, I can't get the application to install to that path.
My directory structure is as follows:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="IIS_WEB_ROOT">
<Directory Id="WEB_SITE_ROOT" Name=".">
<Directory Id="INSTALLLOCATION" Name="$(var.ProductName)">
IIS_WEB_ROOT is defined as:
<Property Id="IIS_WEB_ROOT">
<RegistrySearch Id="Search" Root="HKLM" Key="Software\Microsoft\InetStp" Name="PathWWWRoot" Type="raw" />
</Property>
WEB_SITE_ROOT_PHYSICAL_PATH is set to WEB_SITE_ROOT, as follows:
<Property Id="WEB_SITE_ROOT_PHYSICAL_PATH" Value="WEB_SITE_ROOT"/>
The web site selection dialog is displayed before the installation folder dialog. The installation folder dialog uses the following "standard property":
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
The upshot of all this is that the application is installed into the IIS web root folder - not the web site root folder.
I'm just not sure how to get my installation folder to be set to my dynamically defined WEB_SITE_ROOT_PHYSICAL_PATH property. I need some pointers in the right direction. Do I need another custom action to set the installation folder after the WEB_SITE_ROOT_PHYSICAL_PATH property is set? If so, how do I set this to first after the web site selection dialog completes? Or, have I get all the pieces, but I just haven't wired them up correctly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了将该属性设置为另一个属性的值,您应该编写一个自定义操作:
当然,您应该在定义原始 WEB_SITE_ROOT 属性之后安排此操作。
希望这有帮助。
In order to set the property to the value of another property, you should author a custom action:
Of course, you should schedule this action after the original WEB_SITE_ROOT property is defined.
Hope this helps.