如何在 WIX 中提取文件夹路径?

How to extract a folder path in WIX?

我想使用第二个文件夹浏览器对话框提取安装目录以外的文件夹路径。

 <Control Id="edtDataStoreLocation" Type="PathEdit" X="45" Y="174" Height="18" Width="220"Property="MyProperty"/>

  <Control Id="btnStoreLocation" Type="PushButton" X="270" Y="175" Width="56" Height="17" Text="Browse" >
     <Publish Property="SelectFolderDialog_Property" Value="MyProperty" Order="1">1</Publish>
     <Publish Event="SpawnDialog" Value="SelectFolderDialog" Order="2">1</Publish>
  </Control>

当我在浏览器对话框中单击 确定 时出现错误。以下是错误。

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727.

如何 select 一个文件夹并将此路径提取到 MyProperty

如果需要,您可以使用自定义操作来做到这一点:

    var dialog = new OpenFileDialog
        {
            Filter = @"PFX Files|*.ipa",
            Title = @"Add IPA file"
        };
        if (dialog.ShowDialog() == DialogResult.OK)
        {
            doSometh with the result;

        }