Chris,

I had a similar problem opening the windows OpenFileDialog common dialog. I
found it would work fine on Windows Server 2003 but on Windows 7 it just
hung, showing the same spinning wheel.

I ended up having to open the dialog in a new thread, then all worked fine.

My C# code was as follows:


   public class ShowOpenFileDlg
   {
      private OpenFileDialog _dlg;
      private Session _session;

      public ShowOpenFileDlg(Session session)
      {
         _session = session;
         _dlg = new OpenFileDialog();
      }

      public void Show()
      {
         if (_dlg.ShowDialog() == DialogResult.OK)
         {
            _session["BROWSEFILE"] = _dlg.FileName;
         }
      }
   }

      [CustomAction]
      public static ActionResult ShowFileOpenDlg(Session session)
      {
         ShowOpenFileDlg dlg = new ShowOpenFileDlg(session);
         Thread thread = new Thread(dlg.Show);
         thread.SetApartmentState(ApartmentState.STA);
         thread.Start();
         thread.Join();

         return ActionResult.Success;
      }

As for debugging, I had the same problem with the log file so ended up just
adding MessageBox.Show(...) lines through my code.

Hope this helps.

Steve

McKinnon Chris wrote:
> 
> Hi,
> 
> I have built a managed custom action to check if a UNC path exists.  I'm
> not installing to this path.  This path is simply being set as the value
> of a .config file setting during the install.  I just want to verify
> that it is a valid path.  The custom action is defined as follows:
> 
> [CustomAction]
> public static ActionResult DirectoryExists(Session session)
> {
> CustomActionService service = new CustomActionService();
> return service.DirectoryExists(session);
> }
> 
> I created the custom action project using the Visual Studio template for
> a C# custom action.  This custom action expects a
> "_DirectoryExists_Path" property to contain the path to check.  And it
> populates a "_DirectoryExists_Result" with a "yes" (true) or "no"
> (false) result.  The custom action is just calling
> System.IO.Directory.Exists() to do the check.  I have the custom action
> defined in the installer like so:
> 
> <CustomAction Id="CheckArchiveDirectory"
> BinaryKey="AppDevInstallCustomActions.dll" DllEntry="DirectoryExists"
> Execute="immediate" Return="ignore" Impersonate="yes" />
> 
> And to be called in the UI, like so:
> 
> <Publish Dialog="ServiceOptionsDlg" Control="Back" Event="NewDialog"
> Value="ServiceCredentialsDlg">1</Publish>
> <Publish Dialog="ServiceOptionsDlg" Control="Next"
> Property="_DirectoryExists_Path" Value="[ARCHIVE_PATH]"
> Order="1">1</Publish>
> <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="DoAction"
> Value="CheckArchiveDirectory" Order="2">1</Publish>
> <Publish Dialog="ServiceOptionsDlg" Control="Next" Property="VErr_Text"
> Value="The archive path specified does not exist."
> Order="3"><![CDATA[_DirectoryExists_Result = "no"]]></Publish>
> <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="SpawnDialog"
> Value="ValidationErrDlg" Order="4"><![CDATA[_DirectoryExists_Result =
> "no"]]></Publish>
> <Publish Dialog="ServiceOptionsDlg" Control="Next" Event="NewDialog"
> Value="VerifyReadyDlg" Order="5"><![CDATA[_DirectoryExists_Result =
> "yes"]]></Publish>
> 
> When run to the installer and click the "Next" button, I get the
> spinning blue wheel of death.  I've tried adding a
> "System.Diagnostics.Debugger.Launch();" line to the above code but the
> debugger is never launched.  If I run a verbose log, it just ends at the
> line before the custom action call.  Here's the last 5 lines:
> 
> Action 10:41:55: ServiceOptionsDlg. Dialog created
> MSI (c) (20:44) [10:41:57:524]: Doing action: CheckArchiveDirectory
> Action 10:41:57: CheckArchiveDirectory. 
> Action start 10:41:57: CheckArchiveDirectory.
> MSI (c) (20:6C) [10:41:57:541]: Invoking remote custom action. DLL:
> 
> I'm stumped.   Any ideas or tips for debugging this would be
> appreciated.  I'm also encrypting (and decrypting) my .config files
> using this same managed custom action dll, so I know the DLL is
> partially working.  These custom actions are scheduled in the
> InstallExecuteSequence after "InstallFinalize", however.
> 
> Thanks,
> 
> Chris McKinnon
> 
> 
> 
> The information contained in this e-mail is confidential and may contain
> privileged information. It is intended only for the person or persons
> named above. If you are not an intended recipient of this e-mail please be
> advised that any distribution or copying of this e-mail is prohibited. If
> you have received this e-mail in error, please notify us by return e-mail
> and delete all copies of the e-mail and any attachments.
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 

-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Calling-a-managed-custom-action-from-a-UI-control-tp5639681p5646237.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to