c# - 安装文件或程序在安装时安装在用户定义的路径

标签 c# wix

我是 WiX 工具集的新手。我必须创建一个具有 2 个要求的安装程序:

  1. 将程序安装到默认路径。这很有效。

我想知道的实际情况。 2. 用户可以选择路径。可能有人会帮助如何在用户定义的路径上进行设置或程序安装。

这是我用于默认路径的代码。

<Directory Id="TARGETDIR" Name="SourceDir" />
      <Directory Id="DesktopFolder" Name="Desktop"/>
      <Directory Id="ProgramFilesFolder" />

        <Directory Id="INSTALLDIR" Name="Test" />
          <Directory Id="dirTest" Name="dirTest">

            <Directory Id="ID"  Name="Project Name" />

              <Directory Id="A_ID" Name="NAME" />
                <Directory Id="Queries" Name="Queries" />
                  <Directory Id="v1311" Name="1.3.1.1"/>

最佳答案

在文档中很容易找到

WixUI_InstallDir Dialog Set

WixUI_InstallDir does not allow the user to choose what features to install, but it adds a dialog to let the user choose a directory where the product will be installed.

This dialog set is defined in the file WixUI_InstallDir.wxs in the WixUIExtension in the WiX source code.

Using WixUI_InstallDir

To use WixUI_InstallDir, you must set a property named WIXUI_INSTALLDIR with a value of the ID of the directory you want the user to be able to specify the location of. The directory ID must be all uppercase characters because it must be passed from the UI to the execute sequence to take effect.

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder" Name="PFiles">
    <Directory Id="TESTFILEPRODUCTDIR" Name="Test File">
      ...
    </Directory>
   </Directory>
</Directory>
...
<Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
<UIRef Id="WixUI_InstallDir" />

关于c# - 安装文件或程序在安装时安装在用户定义的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63735860/

相关文章:

c# - 如何使用 UWP 在图像上绘制文本并保存(适用于 Windows 10)

.net - 如何在 WiX 中指定所需的最低 .NET 框架版本

wix - 构建 wixproj 时运行 Paraffin

wix - 如何以可本地化的方式在安装时设置文件夹权限

c++ - 通过组策略安装 VC++ 可再发行组件的最佳方法是什么?

c# - c#中的\uffff是什么

c# - 如何在不等待的情况下等待异步操作的结果?

c# - 在 C# 中解释 Excel 文件

c# - 初始化对象以处理空查询结果

deployment - 是否可以在 MSI 包中添加支持以在安装后更改应用程序的文件夹?