You should be able to do something along these lines: foreach (var k in session.CustomActionData.Keys) { session.Log(k + " = " + session.CustomActionData[k]); }
But you would have to have set the CA data property for that custom action, I think. On 20 May 2013 18:26, Freedman, Mark P. <mark.freed...@jhuapl.edu> wrote: > The execute attribute on Custom action lets you choose immediate, > deferred, etc. An issue I'm seeing in the installer is that accessing a > Session attribute is only allowed if it's immediate execution. So this > makes me think it has to be immediate, but must be after a step that's > after InstallFiles, since the files aren't actually installed. Is there a > set list of the action steps? > > Exception thrown by custom action: > System.Reflection.TargetInvocationException: Exception has been thrown by > the target of an invocation. ---> > Microsoft.Deployment.WindowsInstaller.InstallerException: Cannot access > session details from a non-immediate custom action > at Microsoft.Deployment.WindowsInstaller.Session.ValidateSessionAccess() > at Microsoft.Deployment.WindowsInstaller.Session.get_Item(String > property) > at CustomInstallActions.CustomActions.SetEfxZlibLibrary(Session session) > --- End of inner exception stack trace --- > at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object arguments, SignatureStruct& sig, > MethodAttributes methodAttributes, RuntimeType typeOwner) > at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object arguments, Signature sig, MethodAttributes > methodAttributes, RuntimeType typeOwner) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean > skipVisibilityChecks) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object parameters, CultureInfo culture) > at > Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 > sessionHandle, String entryPoint, IntPtr remotingDelegatePtr) > > When I changed the Action to execute After="InstallFinalize", I was able > to access the session details and the files were in the install directory. > However, my action is failing to do what it's trying to do because of > permissions. The action is attempting to make a copy of a file with a new > name based on if the system is 32/64. I'm guessing the step I'm in in the > installer isn't a step where it has permissions. I'm not sure where I > should be doing these actions, I was able to get these to function in a > Visual Studio deployment project custom action without much grief. > > > Mark Freedman > > > -----Original Message----- > From: Phil Wilson [mailto:phil.wil...@mvps.org] > Sent: Monday, May 20, 2013 1:18 PM > To: 'General discussion for Windows Installer XML toolset.' > Subject: Re: [WiX-users] Getting install path from Wix Custom Action > > The execute sequence runs twice, in custom action terminology the first is > "immediate", when Windows is writing a script to do the install; the second > time it's "deferred" when applied to custom actions, when the system > actually gets changed. That means you can be after InstallFiles in an > immediate custom action and the files haven't been copied yet. You need > immediate="no", I think that's the syntax. > > Custom actions have conditions. A typical condition to cause a CA to run > only at install time is (case sensitive) Not Installed > > Phil > > -----Original Message----- > From: Freedman, Mark P. [mailto:mark.freed...@jhuapl.edu] > Sent: Monday, May 20, 2013 9:55 AM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Getting install path from Wix Custom Action > > Turns out the attribute I was trying to use was INSTALLFOLDER, not > INSTALLDIR, as specified in my Product.wxs. So now, that resolves to the > path I expect. > > However, I'm having a new issue. The custom action is trying to work on a > file that's expeted to be present in my INSTALLFOLDER. I put some > MessageBoxes in the CA for debugging purposes. When the CA is firing, the > files havne't been copied over to the install directory yet. I'd think that > my files would be there at the time since the action isn't firing until > after InstallFiles. What other options do I have? > > Also, my custom action appears to be firing when I uninstall the program. > Again, this is confusing to me given that the action isn't firing until > after InstallFiles. > > Thanks. > > Mark Freedman > > > -----Original Message----- > From: John Cooper [mailto:jocoo...@jackhenry.com] > Sent: Monday, May 20, 2013 12:49 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Getting install path from Wix Custom Action > > First off, scheduling. The values of Directory properties (including one > like INSTALLDIR), aren't going to be meaningful until after CostFinalize. > Since you're running in the InstallExecSequence after InstallFiles, that's > not it. > > However, you should be able to resolve INSTALLDIR like any other public > property. If session["INSTALLDIR"] resolves to nothing, I'm thinking you > haven't saved/restored this property. Is this running in a "Repair" or > "Upgrade"? > > -- > John Merryweather Cooper > Build & Install Engineer - ESA > Jack Henry & Associates, Inc.® > Shawnee Mission, KS 66227 > Office: 913-341-3434 x791011 > jocoo...@jackhenry.com > www.jackhenry.com > > > > > -----Original Message----- > From: Freedman, Mark P. [mailto:mark.freed...@jhuapl.edu] > Sent: Monday, May 20, 2013 11:30 AM > To: wix-users@lists.sourceforge.net > Subject: [WiX-users] Getting install path from Wix Custom Action > > I have a custom action and am trying to access the Install Directory, or > Target path (the base folder that the user chooses to install to). > > Within my Action, I tried pulling it from Session. TARGETDIR maps to > "C:\", despite installing it to program files, and INSTALLDIR yields empty > stirng. > What am I missing? I also tried passing the INSTALLDIR in the CustomAction > tag with the Directory attribute, but it comes back saying that it can't be > something in brackets. > > > [CustomAction] > public static ActionResult SetEfxZlibLibrary(Session session) { > session.Log("Begin CA"); > > string installDirectory = session["INSTALLDIR"]; > > // .... > } > > > <?xml version="1.0" encoding="UTF-8"?> > <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> > <?include Includes.wxi ?> > <Fragment> > <CustomAction Id='SetEfxZlibLibraryAction' > BinaryKey='CustomActionBinary' DllEntry='SetEfxZlibLibrary' > Execute='immediate' > Return='check'/> > > <Binary Id="CustomActionBinary" > SourceFile="$(var.CustomInstallActionsFile)"/> > </Fragment> > </Wix> > > > > Thanks, > > Mark Freedman > > > ---------------------------------------------------------------------------- > -- > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > NOTICE: This electronic mail message and any files transmitted with it are > intended exclusively for the individual or entity to which it is addressed. > The message, together with any attachment, may contain confidential and/or > privileged information. > Any unauthorized review, use, printing, saving, copying, disclosure or > distribution is strictly prohibited. If you have received this message in > error, please immediately advise the sender by reply email and delete all > copies. > > > > ---------------------------------------------------------------------------- > -- > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > ---------------------------------------------------------------------------- > -- > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users