Accessing Windows Installer Session

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an executable that is launched by a custom action in the Windows
Installer. Is there a way to get access to the Session variables (Global
Properties)? Also how do I create a return code if there is a failure and I
want the install to abort?
 
Hi,

Thanks for posting. The custom actions in VS.Net Setup Projects are all
"deferred custom actions". You can try passing the data into the custom
action with the "CustomActionData":

CustomActionData Property
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxgrfcustomactiondataproperty.asp

The following walkthrough maybe useful to you:

Walkthrough: Passing Data to a Custom Action
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxwlkwalkthroughpassingdatatocustomaction.asp

In the walkthrough, the public property "EDITA1" is passed into the custom
action.

If you are work with an unmanaged (or managed) EXE file, you can also try
using the Arguments property for the custom action:

Arguments Property (Custom Actions)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxgrfargumentspropertycustomactions.asp

The usage of "Arguments" is similar to "CustomActionData" to pass the
properties.

To fail the installation in the custom action, you can try throwing an
Exception if it is an InstallerClass or return a non-zero value in the main
function for the EXE file.

I hope the information is useful to you.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I am developing this in InstallShield and the custom action calling the .NET
executable is "Execute Immediately" in the User Interface Sequence. If
vbscript can access the "Session" property there should be a way for me to do
this in the .NET executable.

How do I do this?

Thanks
 
Hi,

I don't think it is possible that we access the property directly with a
Net executable. There are some special support for VBScripts and JScripts
in Windows Installer engines. They are "native" custom actions.

Scripts
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/s
cripts.asp?frame=true

One option that should also work for InstallShield is that we pass the
properties in as command line arguments for the executable.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top