Custom Actions: FolderBrowserDialog not working properly

I have added an installer class with the wizard and use a custom action to start my custom action in the installer class. But when I try to show a Folder Browse Dialog, the folders are missing, so there is nothing to browse with! All the buttons are there OK.

Imports System.ComponentModel

Imports System.Configuration.Install

Public Class Installer

Public Sub New()

MyBase.New()

'This call is required by the Component Designer.

InitializeComponent()

'Add initialization code after the call to InitializeComponent

End Sub

Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

MyBase.Install(stateSaver)

Dim folderBrowserDialog As New FolderBrowserDialog

folderBrowserDialog.ShowDialog()

End Sub

Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)

MyBase.Uninstall(savedState)

End Sub

End Class

I am using VS 2005.

Any one seen this before, I’m a bit stuck

Cheers

Julian



Answer this question

Custom Actions: FolderBrowserDialog not working properly

  • Gage

    Here’s a picture of the problem:

    http://www.v8914.com/pic.jpg

    Does the Folder Browse Dialog look the same on any one else’s PC

    Really appreciate any help

    Julian


  • SteveTr

    I am able to repro this problem myself.

    These managed custom actions are not really intended to do UI based actions.

    I think what's happening is that the custom action is being run under a "system" account. Being under this account may be causing problems with the dialog as it may not have some resources it needs to discover or render the folders.

    A workaround is that you can use the OpenFileDialog... It's not quite ideal, but you can use System.IO.Path.GetDirectoryName() to get only the folder path.

    HTH



  • CoolMicheal

    Instead of using a custom action I strongly recommend using the built in user interface capabilities of Windows Installer. A Browse Dialog is described in MSI Help at http://msdn.microsoft.com/library/en-us/msi/setup/browse_dialog.asp

    Most Windows Installer authoring tools already include such a dialog that you can use. If Visual Studio doesn't then you would have to post-process the built msi file (not trivial) or use a more powerful MSI authoring tool. A list of such tools (including commercial, freeware and open source) can be found at http://www.installsite.org/go/msidev.htm



  • Peter H

    Thanks for the help guys, very usefull

    Julian


  • Custom Actions: FolderBrowserDialog not working properly