如何在 Wix 中设置属性
我对在 Wix 中设置属性的正确过程感到困惑。是否有必要使用Event?是否存在现有的内置事件?它们是否可以根据自定义 Wix 属性进行定制?我想要做的(使用 Wix 3.0)是使用自定义 UI 安装 IIS 虚拟目录。这里的问题是,我尝试设置虚拟目录名称的属性没有被界面中提供的值覆盖。这里用于安装路径的另一个属性被覆盖,看起来 Event="SetTargetPath" 正在处理这个问题,我是否错了或遗漏了这个安装 UI 的某些内容?非常感谢您的帮助。
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="MyCo" Name="MyCo">
<Directory Id="FILEINSTALLDIR" Name="MyCo Admin">
<Component Id="MyCo_AdminComponent" Guid="########-####-####-####-############">
<File Source="Default.aspx" Vital="yes" KeyPath="yes" DiskId="1"/>
</Component>
</Directory>
</Directory>
</Directory>
<Component Id='ADMINVIRTUALDIRCOMP' Guid='########-####-####-####-############' Permanent='no'>
<iis:WebVirtualDir Id='VIRTUALDIRECTORY' Alias='[WIXUI_VIRTUALDIR]' Directory='FILEINSTALLDIR' WebSite='DefaultWebSite'>
<iis:WebApplication Id='ADMINWEBAPPLICATION' Name='[WIXUI_VIRTUALDIR]' />
</iis:WebVirtualDir>
</Component>
</Directory>
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site'>
<iis:WebAddress Id='AllUnassigned' Port='80' />
</iis:WebSite>
<Feature Id="ProductFeature" Title="MyCo WebApp" Level="1">
<ComponentRef Id="MyCo_AdminComponent" />
<ComponentRef Id="ADMINVIRTUALDIRCOMP" />
</Feature>
<UIRef Id="WixUI_Common" />
<UIRef Id="WixUI_InstallWeb" />
<Property Id="WIXUI_INSTALLDIR" Value="FILEINSTALLDIR" />
<Property Id="WIXUI_VIRTUALDIR" Value ="VIRTUALDIR" ></Property>
<Property Id="VIRTUALDIR" ><![CDATA[AdminCompName]]></Property>
<UI Id="WixUI_InstallWeb">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4">
<![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]>
</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallWebDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">
NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3">
<![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">
WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallWebDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
<Dialog Id="InstallWebDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
<Control Id="VirtualDirLabel" Type="Text" X="20" Y="160" Width="290" Height="10" NoPrefix="yes" Text="Virtual Directory:" />
<Control Id="VirtualDir" Type="Edit" X="20" Y="172" Width="320" Height="18" Property="WIXUI_VIRTUALDIR" Indirect="yes" />
</Dialog>
</UI>
I'm confused about the correct procedure for setting a Property in Wix. Is it necessary to use an Event? Are there existing, built-in, events and can they be tailored to custom Wix Properties? What I'm trying to do (with Wix 3.0) is install a IIS Virtual Directory using a custom UI. The problem here is that the property I'm attempting to set the virtual directory name with is not being over-written from the value provided in the interface. The other property here used for the installation path is being over-written and it looks like the Event="SetTargetPath" is what is taking care of that, am I wrong or missing something with this installation UI? Thanks much for your help.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="MyCo" Name="MyCo">
<Directory Id="FILEINSTALLDIR" Name="MyCo Admin">
<Component Id="MyCo_AdminComponent" Guid="########-####-####-####-############">
<File Source="Default.aspx" Vital="yes" KeyPath="yes" DiskId="1"/>
</Component>
</Directory>
</Directory>
</Directory>
<Component Id='ADMINVIRTUALDIRCOMP' Guid='########-####-####-####-############' Permanent='no'>
<iis:WebVirtualDir Id='VIRTUALDIRECTORY' Alias='[WIXUI_VIRTUALDIR]' Directory='FILEINSTALLDIR' WebSite='DefaultWebSite'>
<iis:WebApplication Id='ADMINWEBAPPLICATION' Name='[WIXUI_VIRTUALDIR]' />
</iis:WebVirtualDir>
</Component>
</Directory>
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site'>
<iis:WebAddress Id='AllUnassigned' Port='80' />
</iis:WebSite>
<Feature Id="ProductFeature" Title="MyCo WebApp" Level="1">
<ComponentRef Id="MyCo_AdminComponent" />
<ComponentRef Id="ADMINVIRTUALDIRCOMP" />
</Feature>
<UIRef Id="WixUI_Common" />
<UIRef Id="WixUI_InstallWeb" />
<Property Id="WIXUI_INSTALLDIR" Value="FILEINSTALLDIR" />
<Property Id="WIXUI_VIRTUALDIR" Value ="VIRTUALDIR" ></Property>
<Property Id="VIRTUALDIR" ><![CDATA[AdminCompName]]></Property>
<UI Id="WixUI_InstallWeb">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4">
<![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]>
</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallWebDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">
NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3">
<![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">
WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallWebDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
<Dialog Id="InstallWebDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
<Control Id="VirtualDirLabel" Type="Text" X="20" Y="160" Width="290" Height="10" NoPrefix="yes" Text="Virtual Directory:" />
<Control Id="VirtualDir" Type="Edit" X="20" Y="172" Width="320" Height="18" Property="WIXUI_VIRTUALDIR" Indirect="yes" />
</Dialog>
</UI>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否有必要使用事件?是否存在现有的内置事件,并且可以将它们定制为自定义 Wix 属性吗?
不,没有必要使用事件来设置属性值;它们可以通过自定义操作或根据条件显式设置。要回答第二个问题,不,没有可以根据 Wix 中的自定义属性进行定制的事件模型。
我忍不住想知道未设置虚拟目录名称的问题是否与您的 VIRTUALDIR 属性没有 安全 属性。看看
也许尝试将 Secure="yes" 添加到属性中,看看是否有效?
Is it necessary to use an Event? Are there existing, built-in, events and can they be tailored to custom Wix Properties?
No, it is not necessary to use an Event to set property values; they can be set explicitly, via custom actions, or from conditions. To answer the second question, no, there isn't an event model which you can tailor to custom properties within Wix.
I can't help but wonder if your problem of the virtual directory name not being set has to do with your VIRTUALDIR property not having the Secure attribute. Take a look at this model. I'm not certain, but I think only secure properties can move from the client (pink) area to the server (green) area.
Perhaps try adding Secure="yes" to the property and see if that does the trick?