我希望能夠從註冊表中讀取一個值,並在顯示對話框之前使用它來設置WIXUI_INSTALLDIR,但是如果註冊表中的值爲空白,我想使用默認文件夾。將WIXUI_INSTALLDIR設置爲註冊表值或默認值(如果爲空)?
我是wix新手。 我一直在閱讀教程,文檔和問題/答案,我的腦袋正在旋轉。我覺得我很接近,但我沒有把所有的東西放在一起。
代碼編譯和鏈接很好,但是當我運行msi時,我在顯示瀏覽文件夾對話框之前收到錯誤,錯誤代碼爲2819「對話框[2]上的控件[3]需要鏈接到它的屬性「。
總之,我想要做的是:
從註冊表中讀取以前的安裝路徑到名爲「PREVIOUSINSTALLFOLDER」的屬性中。
如果「PREVIOUSINSTALLFOLDER」爲空,請將WIXUI_INSTALLDIR設置爲「目錄」部分中定義的「INSTALLFOLDER」。
如果「PREVIOUSSTALLFOLDER」不爲空,請將WIXUI_INSTALLDIR設置爲「PREVIOUSINSTALLFOLDER」。
我在做什麼錯?
感謝, 埃裏克
這裏是我當前的代碼:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="EB907F6C-B193-4A40-BA3C-ADF8C069AF34" Name="LaserVault DMS" Language="1033" Version="10.0.0" Manufacturer="Electronic Storage Corp." UpgradeCode="43291cbc-3f74-44ba-ba14-31181bb654bf">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Keywords="LaserVault DMS Server" Description="LaserVault DMS Server" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<UIRef Id="WixUI_InstallDir"/>
<Property Id="PREVIOUSINSTALLFOLDER">
<RegistrySearch Id="PreviousInstallDir" Root="HKLM" Key="Software\ESC" Name="LVDMSPath" Type="raw"></RegistrySearch>
</Property>
<CustomAction Id="SetToDefault" Property="WIXUI_INSTALLDIR" Value="[INSTALLFOLDER]" Execute="immediate" />
<CustomAction Id="SetToPrevious" Property="WIXUI_INSTALLDIR" Value="[PREVIOUSINSTALLFOLDER]" Execute="immediate" />
<InstallExecuteSequence>
<Custom Action="SetToDefault" After="AppSearch">PREVIOUSINSTALLDIR=""</Custom>
<Custom Action="SetToPrevious" After="AppSearch"><![CDATA[PREVIOUSINSTALLDIR <> ""]]></Custom>
</InstallExecuteSequence>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LaserVault" Name="LaserVault">
<Directory Id="INSTALLFOLDER" Name="LVDMS" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="LaserVault DMS" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="LVDMSServerConfig" Guid="D9428A16-ECB1-4373-B876-8CF05E7CE37F">
<File Id="LVDMSServerConfig" Source="C:\Projects\LVDMS10\LVDMSServerConfig\LVDMSServerConfig\bin\Debug\LVDMSServerConfig.exe" KeyPath="yes" />
</Component>
<Component Id="LVDMSCore10" Guid="2E956300-78FC-4AFA-8D5D-A2D07B6CB8AE">
<File Id="LVDMSCore10" Source="C:\Projects\LVDMS10\LVDMSServerConfig\LVDMSServerConfig\bin\Debug\LVDMSCore10.dll" KeyPath="yes" />
</Component>
<Component Id="LVDMSInstallationGuide" Guid="ECA2B30A-54CB-4DE4-A659-B429458BDF3A">
<File Id="LVDMSInstallationGuide" Source="\\192.168.0.211\development\HelpFiles\LaserVault_DMS_10\LaserVault_DMS_Installation_Guide\LaserVault_DMS_Installation_Guide.pdf" KeyPath="yes" />
</Component>
</ComponentGroup>
<ComponentGroup Id="Shortcuts" Directory="ProgramMenuDir">
<Component Id="LVDMSServerConfigShortCut">
<Shortcut Id="LVDMSServerConfigShortCut" Name="LVDMS Server Config" Description="LaserVault DMS Server Configuration" Target="[#LVDMSServerConfig]" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\LaserVault\LVDMS" Name="CurrentVersion" Type="string" Value="[ProductVersion]" KeyPath="yes" />
</Component>
</ComponentGroup>
<ComponentGroup Id="RegistryEntries">
<Component Id="RegistryLVDMSPath" Guid="9AE59D2B-EF16-4CAA-8A27-AA5BE00FAA07" Permanent="yes" Directory="TARGETDIR">
<RegistryKey Root="HKLM" Key="Software\ESC">
<RegistryValue Type="string" Name="LVDMSPath" Value="[INSTALLFOLDER]"/>
</RegistryKey>
</Component>
</ComponentGroup>
<Feature Id="Complete" Title="LaserVault DMS Server" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="Shortcuts"/>
<ComponentGroupRef Id="RegistryEntries"/>
</Feature>
</Product>
我會使用/ L * V [日誌文件]執行您的微星,看看發生了什麼事情,這將表明,當/如果您的自定義行動正在執行中。也許自定義操作需要在AppSearch之前的InstallUISequence中進行安排。 –