如何在WIX中的安装时启用更改目录? [英] How do I enable changing the directory at installtion in WIX?

查看:106
本文介绍了如何在WIX中的安装时启用更改目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Product.wxs如下:

I have my Product.wxs as following:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"

     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"

     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"

     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">

    <Product Id="{435E9821-4CF2-429C-B784-BC4EAB2496E6}" Name="CSAKeyManagerService" Language="1033" Version="1.0.0.0" Manufacturer="Diebold" UpgradeCode="{5356EB8B-DB68-4AE9-8D18-1681BF45496E}">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <Media Id="1" Cabinet="CSAKeyManagerService.cab" EmbedCab="yes" />

    <PropertyRef Id="NETFRAMEWORK30_SP_LEVEL" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

    <Property Id="IISROOT"> 
      <RegistrySearch Id="IISROOT" 

                      Type="directory" 

                      Root="HKLM" 

                      Key="Software\Microsoft\InetStp" 

                      Name="PathWWWRoot" /> 
    </Property> 

    <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="IISROOT" Name="WebDir">
                <Directory Id="INSTALLFOLDER" Name="CSAKeyManagerService" />
          <Directory Id="WEBAPPWEBSITE" Name="CSAKeyManagerService">
             <!--Continue in DirectoryRef with specific name--> 
          </Directory>
            </Directory>
        </Directory>

        <Feature Id="ProductFeature" Title="CSAKeyManagerService" Level="1" ConfigurableDirectory="INSTALLFOLDER">
      <!-- Include IIS Configuration. -->
      <ComponentGroupRef Id="WebAppIssConfiguration" />

      <!-- Include web content. -->
      <ComponentGroupRef Id="WebAppWebComponents" />            

      <!-- Perform changes in the web.config file. -->
      <ComponentRef Id="WebConfigCmp" />

        </Feature>

  <DirectoryRef Id="WEBAPPWEBSITE">
      <!-- Component handling the web.config -->
      <Component Id="WebConfigCmp" Guid="">
        <!-- Copy web.config to WEBAPPWEBSITE folder. -->
         </Component>
    </DirectoryRef>

    <!-- .NET Framework 3.0 SP 1 must be installed -->
    <Property Id="FRAMEWORKBASEPATH">
      <RegistrySearch Id="FindFrameworkDir" Root="HKLM"

        Key="SOFTWARE\Microsoft\.NETFramework"

        Name="InstallRoot" Type="raw"/>
    </Property>

    <Property Id="ASPNETREGIIS" >
      <DirectorySearch Path="[FRAMEWORKBASEPATH]"

                  Depth="4" Id="FindAspNetRegIis">
        <FileSearch Name="aspnet_regiis.exe" MinVersion="2.0.5"/>
      </DirectorySearch>
    </Property>

    <!-- Switch ASP.NET to version 2.0 -->
    <CustomAction Id="MakeWepApp20" Directory="WEBAPPWEBSITE"

      ExeCommand="[ASPNETREGIIS] -norestart -s W3SVC/1/ROOT/[WEB_APP_NAME]"

      Return="check"/>

    <InstallExecuteSequence>
      <Custom Action="MakeWepApp20" After="InstallFinalize">
        ASPNETREGIIS AND NOT Installed
      </Custom>
    </InstallExecuteSequence>

    <!-- License and images -->
    <!--<WixVariable Id="WixUILicenseRtf" Value="$(var.WebAppResourceDir)\License.rtf" />-->

    <!-- Specify UI -->
    <UIRef Id="MyUI" />
    </Product>


</Wix>



我的DemoUI.wxs如下:


And I have my DemoUI.wxs as below:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
    <UI Id="MyUI">
      <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="InstallDirDlg">NOT Installed</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

      <!--<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>-->

      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="IISSetupDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

      <Publish Dialog="IISSetupDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg"></Publish>
      <Publish Dialog="IISSetupDlg" Control="Next" Event="NewDialog" Value="PoolSettingsDlg"></Publish>

      <Publish Dialog="PoolSettingsDlg" Control="Back" Event="NewDialog" Value="IISSetupDlg"></Publish>
      <Publish Dialog="PoolSettingsDlg" Control="Next" Event="NewDialog" Value="DatabaseDlg"></Publish>

      <Publish Dialog="DatabaseDlg" Control="Back" Event="NewDialog" Value="PoolSettingsDlg"></Publish>
      <Publish Dialog="DatabaseDlg" Control="Next" Event="NewDialog" Value="KeysDlg"></Publish>

      <Publish Dialog="KeysDlg" Control="Back" Event="NewDialog" Value="DatabaseDlg"></Publish>
      <Publish Dialog="KeysDlg" Control="Next" Event="NewDialog" Value="CloudSettingsDlg1"></Publish>

      <Publish Dialog="CloudSettingsDlg1" Control="Back" Event="NewDialog" Value="KeysDlg"></Publish>
      <Publish Dialog="CloudSettingsDlg1" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"></Publish>

      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CloudSettingsDlg1" Order="1">NOT Installed</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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" />
    </UI>

    <UIRef Id="WixUI_Common" />

    </Fragment>
</Wix>



Now, the issue is,here,eventhough it allows the user to select a new directory to install at the time of installation,actually it is creating inside my C:/inetpub/wwwroot instead of the chosen directory.Can you please let me know where I am missing something? Thanks.


Now, the issue is,here,eventhough it allows the user to select a new directory to install at the time of installation,actually it is creating inside my C:/inetpub/wwwroot instead of the chosen directory.Can you please let me know where I am missing something? Thanks.

推荐答案

(var.WebAppResourceDir)\License.rtf\" />-->

<!-- Specify UI -->
<UIRef Id=\"MyUI\" />
</Product>


</Wix>
(var.WebAppResourceDir)\License.rtf" />--> <!-- Specify UI --> <UIRef Id="MyUI" /> </Product> </Wix>



And I have my DemoU I.wxs as below:


And I have my DemoUI.wxs as below:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
    <UI Id="MyUI">
      <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="InstallDirDlg">NOT Installed</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

      <!--<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>-->

      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="IISSetupDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

      <Publish Dialog="IISSetupDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg"></Publish>
      <Publish Dialog="IISSetupDlg" Control="Next" Event="NewDialog" Value="PoolSettingsDlg"></Publish>

      <Publish Dialog="PoolSettingsDlg" Control="Back" Event="NewDialog" Value="IISSetupDlg"></Publish>
      <Publish Dialog="PoolSettingsDlg" Control="Next" Event="NewDialog" Value="DatabaseDlg"></Publish>

      <Publish Dialog="DatabaseDlg" Control="Back" Event="NewDialog" Value="PoolSettingsDlg"></Publish>
      <Publish Dialog="DatabaseDlg" Control="Next" Event="NewDialog" Value="KeysDlg"></Publish>

      <Publish Dialog="KeysDlg" Control="Back" Event="NewDialog" Value="DatabaseDlg"></Publish>
      <Publish Dialog="KeysDlg" Control="Next" Event="NewDialog" Value="CloudSettingsDlg1"></Publish>

      <Publish Dialog="CloudSettingsDlg1" Control="Back" Event="NewDialog" Value="KeysDlg"></Publish>
      <Publish Dialog="CloudSettingsDlg1" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"></Publish>

      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CloudSettingsDlg1" Order="1">NOT Installed</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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" />
    </UI>

    <UIRef Id="WixUI_Common" />

    </Fragment>
</Wix>



Now, the issue is,here,eventhough it allows the user to select a new directory to install at the time of installation,actually it is creating inside my C:/inetpub/wwwroot instead of the chosen directory.Can you please let me know where I am missing something? Thanks.


Now, the issue is,here,eventhough it allows the user to select a new directory to install at the time of installation,actually it is creating inside my C:/inetpub/wwwroot instead of the chosen directory.Can you please let me know where I am missing something? Thanks.


See here:

http://wix.tramontana.co.hu/tutorial/user-interface/ui-wizardry[^]



Try WixUI_Mondo, or WixUI_InstallDir.



Hope this helps,

Pablo.
See here:
http://wix.tramontana.co.hu/tutorial/user-interface/ui-wizardry[^]

Try WixUI_Mondo, or WixUI_InstallDir.

Hope this helps,
Pablo.


这篇关于如何在WIX中的安装时启用更改目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆