WIX 更改默认安装路径 [英] WIX Change the default Install Path

查看:45
本文介绍了WIX 更改默认安装路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将默认安装路径更改为用户的主目录/产品名称.

I am trying to change the default install path to User's Home directory/ProductName.

下面是我的代码(不是全部代码)

Below is my code(its not the entire code)

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
<Property Id="ENVIRONMENT" Secure="yes" />
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />

<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
  <Component Id="InstallScripts"  Guid="someGUID">        
    <File Id="file1.il" Source="$(var.ScriptsFolder)\file1.il"/>
    <File Id="file2.il" Source="$(var.ScriptsFolder)\file2.il"/>
  </Component>
</DirectoryRef>    
<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="ProgramMenuSubfolder" Name="CompanyName">
          <Directory Id="ScriptsFolder" Name="SoftwareName" />
          <Directory Id="INSTALLFOLDER" Name="SoftwareName" />

            <Component Id="Registry_FriendlyName">
                <RegistryValue Id="RegKey_FriendlyName" Root="HKCU"
                       Key="Software\Microsoft\Office\Excel\AddIns\AddIn1"
                       Name="FriendlyName"
                       Value="AddIn1"
                       Type="string" KeyPath="yes" />
            </Component>            
            <Component Id="Registry_Manifest" Guid="SomeGUID">
                <RegistryKey Root="HKCU" Key="Software\Microsoft\Office\Excel\AddIns\AddIn1" Action="create">
                    <RegistryValue Id="RegKey_Manifest" Name="Manifest" Type="string" Value="[INSTALLFOLDER]ViolationsAddIn.vsto|vstolocal" KeyPath="yes" />              
                </RegistryKey>            
            </Component>
            <Directory Id="GAC" Name="GAC">            
                <Component Id="dll_gac_Component" DiskId="1" Guid="SomeGUID">
                  <File Id="Core_dll_gac" KeyPath="yes"
                        Name="Core.dll" Source="$(var.variable1)"  Assembly=".net"></File>
                </Component>
            </Directory>
        </Directory>
    </Directory>
</Directory>

如果你看到上面的代码......现在默认路径是InstallFolder,它是SoftwareName文件夹.我在其他几个地方使用这个 InstalFolder 来复制几个文件 (DirectoryRef),添加注册表值等.现在我想将默认安装路径设置为用户主目录,用户可以将其更改为其他任何内容而不会破坏这些功能.请帮帮我.

If you see above code.. right now the default path is InstallFolder which is SoftwareName folder. I am using this InstalFolder in few more places to copy few files (DirectoryRef), adding registry values etc. Now I would like to set the default install path to Users Home Directory and users can change it to anything else without breaking these features. Please help me.

感谢任何帮助.

谢谢

推荐答案

除了ProgramFilesFolder,还有很多标准的系统文件夹属性.

In addition to ProgramFilesFolder, there are many standard system folder properties.

您会注意到您指定的文件夹(用户的配置文件文件夹)不是 Windows Installer 中定义的文件夹.原因是操作系统设计者在为每个操作系统版本创建配置文件布局时有很多目标.其中之一是预期用户在登录域中的不同计算机(漫游配置文件)时会希望将某些数据从计算机复制到计算机.而且,他们会希望其他数据不被复制.

You'll notice that the folder you indicate (user's profile folder) is not a defined folder in Windows Installer. The reason is that the operating system designers have a lot of goals in mind when they create profile layouts for each operating system release. One of which is anticipating that users will want some data copied from computer to computer as they log into different computers in a domain (roaming profile). And, they'll want other data not to be copied.

要在这种设计下安装软件,您必须知道您是否希望它漫游,然后适当地选择一个安装文件夹.查看 AppDataFolderLocalAppDataFolder.

To install software under this design, you have to know if you want it roaming or not, and then select an installation folder appropriately. Look at AppDataFolder and LocalAppDataFolder.

这篇关于WIX 更改默认安装路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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