pthalacker
pthalacker

Reputation: 2124

WIX Browse dialog fails with error 2727 directory is not in directory table

I am using the WIX default BrowseDlg to capture a value to insert into the web.config file. I am using code that I have seen in numerous places now.

<Control Id="btnDirBrowse" Type="PushButton" Width="56" Height="17" X="260" Y="57" 
          Text="!(loc.DataDialog.BrowseCaption)" >
  <Publish Property="_BrowseProperty" Value="DATALOCATION" Order="1">1</Publish>
  <Publish Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</Control>

The problem I have is that when I click ok after navigating to a file location, I get error 2727:

The directory entry '[2]' does not exist in the Directory table.

The value I am getting represents the location of data files that have already been installed on the system. This location has nothing to do with the installer other than being a string value to write to web.config. If I don't use BrowseDlg and just enter a string in the textbox of my custom dialog, everything works fine, but if I use BrowseDlg, I get this error.

The location of the existing data files could be anywhere on the network, so I have no idea how to establish a reference in the Directory table.

What can I do to make BrowseDlg happy?

Upvotes: 3

Views: 1193

Answers (1)

Cyrus Downey
Cyrus Downey

Reputation: 223

I just wanted to provide an fix that worked for me. I was having the same issue but with the default directory browser in wix.

My problem was that my "WIXUI_INSTALLDIR" property was something other than "TARGETDIR". Essentially, from what I'm guessing the "Directory table" must reference a directory created by a Directory tag.

For example:

<Directory Id="TARGETDIR" Name="SourceDir"> 

The below fixed my issue

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

Upvotes: 1

Related Questions