Question

The wix DirectoryCombo element has the attributes Remote and Fixed. By setting the Remote attribute to no, network shares are removed from the drop down list created by this element. Likewise, setting the Fixed attribute to no results in a list which excludes local drives. My problem is that I can't restrict the list to only show network shares. If Remote is set to yes and Fixed is set to no, I expect the drop down list to do what I want, i.e. only show network shares. But the default entry in that list always shows the property value its Property attribute is assigned to.

Is there a way to prevent this default entry from showing up?

Was it helpful?

Solution

Yes. You can prevent this by setting anyone of the network drive value to that DirectoryCombo Property before run that dialog. Write a custom action to read the network drives and set any one of the drive value to that Directory property and schedule the custom action in InstallUISequence.

[CustomAction]
    public static ActionResult CustomAction1(Session session)
    {       
        DriveInfo[] drives = DriveInfo.GetDrives();
        foreach (DriveInfo drvInfo in drives)
        {
            if (drvInfo.DriveType == DriveType.Network)
            {
                session["SHARED_DRIVE"] = drvInfo.Name;
                break;
            }
        }
        return ActionResult.Success;
    }

  <Binary Id="SharedDrive" SourceFile="TestProject.CA.dll" />
  <CustomAction Id="SHAREDDRIVE" BinaryKey="SharedDrive" DllEntry="CustomAction1" Return="check" />

 <InstallUISequence>
     <Custom Action="SHAREDDRIVE" After="AppSearch">Not Installed</Custom>
 </InstallUISequence>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top