2017-10-04 132 views
1

我用下面的代码构建我的* .msi与WiX工具集,我需要将其安装到自定义文件夹(而不是ProgramFiles)。如何将应用程序安装到自定义文件夹?

我可以从源文件或注册表键中获得安装路径吗?

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

回答

0

[解决]

MyAppInstallationPath.ini文件

[Data] 
Path=V:\ 

* .wsx文件

<Fragment> 
    <Property Id="INSTALLPATH"> 
     <IniFileSearch Id="MyAppInstalationPath" Type="directory" Name="MyAppInstallationPath.ini" Section="State" Key="Data" /> 
    </Property> 
    </Fragment> 

    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="INTALLPATH" Name="MyApp"> 
     <Directory Id="INSTALLFOLDER" Name="MySetup" /> 
     </Directory> 
    </Directory> 
    </Fragment> 

    <Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <Component Id="ProductComponent" Guid="F49934B4-6DE4-4EF1-8CDF-A4C758378FD5"> 
     <File Id="Calc" DiskId="1" Source="C:\WINDOWS\system32\calc.exe" /> 
     </Component> 
    </ComponentGroup> 
    </Fragment> 
相关问题