无法在WixUI_InstallDir中自定义安装目录,即使全部为大写

时间:2016-01-13 11:47:30

标签: wix

我使用非常基本的Wix配置来测试安装程序,但我无法以任何方式更改默认安装位置。它始终安装到C:\Program Files (x86)\Project Name,无论我做什么。该变量仅使用大写字母INSTALLFOLDER

我也尝试了secure="yes"secure="no"

我也尝试过一个以前从未安装过这个程序的新VM。也仅安装到C:\Program Files (x86)\Project Name

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Product Id="94B11B8E-FD40-4840-96E4-1C89A62B1EBD" Name="Project Name" Language="1033" Version="1.0.0.0" Manufacturer="Company Name" UpgradeCode="7dda6b29-4fa7-45d1-a2f7-9e03ccf88289">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of Project Name is already installed." />
        <MediaTemplate />

        <UIRef Id="WixUI_InstallDir" />
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
        <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />

        <Feature Id="ProductFeature" Title="Project Name" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Project Name"/>
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="ProductComponent" Guid="3E000548-22E3-4424-BF9F-748D92E213D0">
                <File Source="$(var.ProjectName.TargetPath)" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

已安装的Wix版本为3.10.1.2213。

在安装程序的详细日志文件中,我收到以下事件:

MSI (c) (F8:2C) [12:55:40:067]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\Project Name\'. Its new value: 'C:\Program Files (x86)\'.
MSI (c) (F8:2C) [12:55:42:610]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\'. Its new value: 'C:\Program Files (x86)\Project Name\'.
MSI (c) (F8:2C) [12:55:45:606]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\Project Name\'. Its new value: 'C:\Program Files (x86)\saafasdsafdfsafd\'.

[...]

Action 12:55:49: ExecuteAction. 
Action start 12:55:49: ExecuteAction.
[...]
MSI (c) (F8:C0) [12:55:49:366]: Switching to server: INSTALLFOLDER="C:\Program Files (x86)\saafasdsafdfsafd\" TARGETDIR="C:\" CURRENTDIRECTORY="D:\" CLIENTUILEVEL="0" CLIENTPROCESSID="3832" USERNAME="somename" SOURCEDIR="D:\" ACTION="INSTALL" EXECUTEACTION="INSTALL" ROOTDRIVE="C:\" INSTALLLEVEL="1" SECONDSEQUENCE="1" WIXUI_INSTALLDIR_VALID="1"  ADDLOCAL=ProductFeature  
[...]
MSI (s) (CC:68) [12:55:49:600]: ******* RunEngine:
       ******* Product: D:\Project Name.msi
       ******* Action: INSTALL
       ******* CommandLine: **********
[...]
MSI (s) (CC:68) [12:56:24:861]: Command Line: INSTALLFOLDER=C:\Program Files (x86)\saafasdsafdfsafd\ TARGETDIR=C:\ CURRENTDIRECTORY=D:\ CLIENTUILEVEL=0 CLIENTPROCESSID=3832 USERNAME=somename SOURCEDIR=D:\ ACTION=INSTALL EXECUTEACTION=INSTALL ROOTDRIVE=C:\ INSTALLLEVEL=1 SECONDSEQUENCE=1 WIXUI_INSTALLDIR_VALID=1 ADDLOCAL=ProductFeature ACTION=INSTALL 
[...]
MSI (s) (CC:68) [12:56:24:861]: Ignoring disallowed property INSTALLFOLDER
[...]
Action 12:56:24: CostFinalize. Computing space requirements
Action start 12:56:24: CostFinalize.
[...]
MSI (s) (CC:68) [12:56:24:876]: Dir (target): Key: INSTALLFOLDER    , Object: C:\Program Files (x86)\Project Name\
[...]
Property(S): INSTALLFOLDER = C:\Program Files (x86)\Project Name\
[...]
Property(C): INSTALLFOLDER = C:\Program Files (x86)\saafasdsafdfsafd\

任何人都知道出了什么问题?这个不允许的属性行怎么样?请注意我在这两个版本中都得到了这一行:

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" Secure="yes" />

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

1 个答案:

答案 0 :(得分:1)

如果你添加property with the same name as the folder ID并设置这个 Secure,它就会有效:

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Property Id="INSTALLFOLDER" Secure="yes" />