PDA

View Full Version : How Do I Add A Custom Action?



cst_user
05-12-2009, 03:51 PM
I have a VB6 application that has worked fine on every non-server version of Windows from 98 through XP. And then came Vista.

The application has three MS Access databases that are kept in a data subfolder under the main program folder that are written to through out the use of the application. The problem is that the program is installed under Program Files by default, and of course Vista does not allow write access to this folder. I upgraded from ISE 11.5 to 2009 because I was led to believe that I could easily create an install package that could tell what OS the app was being installed on and then install it in either Program Files (for pre-Vista OS's) or AppData folder.

"Easily" was the key word in that last sentence and I'm sad to say that it has not been the case. I first tried to create 2 features, one for Vista and one for older OS's, but the Installation Designer would not let me set an InstallDir for the features seperately; I had to use just one InstallDir for the entire package.

Not happy.

Did a bunch of research and it seems I've found a solution to my issue; I just need to add a Type 51 Custom Action to my package that will set the value of InstallDir based on the value of VersionNT.

Nifty!

But, um, the problem is that I can't seem to find any information on how to *actually* add said custom action. Sure, the help file for ISE 2009 has many entries about Custom Actions, the CustomAction Table and the various types of custom actions you can add, but I can't find an entry that *actually explains* exactly how to add said custom action.

Same goes for the forums here (which is where I found the solution I'm trying to implement, by the way).

So, can some please, please kindly point me to something that can walk me through the steps of adding a Custom Action to my install package? Please???

Z

cst_user
05-14-2009, 07:46 AM
Ok. Two dozen views and no responses. :confused:

Either I've asked a really stupid question and the nice people here want to spare my feelings, or I've asked a question to which there really is no answer, despite the fact that adding a custom action is talked about quite a bit.

I'm not much of a betting man, but if I were, I'd place my money on the first option.

Z

MichaelU
05-14-2009, 11:56 AM
InstallShield Express does not support adding type 51 actions. If you go to (5) Custom Actions, you can add a DLL or VBScript action, either of which can be written to match the effect of the type 51 action. Alternately, the Professional or Premier editions do support adding the type 51 action.

That said, I disagree with your premise. A non-administrator account similarly lacks access to this location on XP. If you require an administrator account, you should manifest your application accordingly, and it should work in the privileged location on Vista as well. If you do not require an administrator account, you should probably use the safe location on XP as well.

cst_user
05-15-2009, 07:56 AM
Oh, I see.

The app does presently require the install base to be given admin rights to the install folder (and the sub folders) on XP...

Thank you for the information, MichaelU. It is of great help to me and we can consider the thread closed / resolved.

Now I just need to go explain to my boss why our recent purchase was pointless (shame on me for not performing adequate research first). :(

EDIT: As a quick follow-up, I did finally find a solution to my problem after several days of intensive web seraching, bouncing from blog to support sites to msd and back again. I wanted to share it here for anyone else that was hoping to get an answer to the same or a similar problem.

Find and download Orca from Microsoft's MSDN web site. It's free and works wonderfully for this purpose. (I suppose one could use Wix as well, but I used Orca.)

On the General Information section of my install package, I set INSTALLDIR = "[USERS]\Product Name". This installs the application into the Users directory on Vista which gives the user read/write access to the Access database files it uses. I used Vista as the default and then modified the .msi file to use a different directory if the OS was older than Windows Server 2003.

Create your install package with ISE as normal, then open the .msi file with Orca. Click on the "Tools" menu, then click on "Options...". Click on the Database tab and then put a check mark in "Copy embedded streams during 'Save As.'. Click the "OK" button.

On the left-hand pane, click on CustomAction. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Type="51", Source="INSTALLDIR", Target="[ProgramFileFolders]". Click the "OK" button.

Back on the left-hand pane, click on InstallExecuteSequence. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Condition="VersionNT < 502", Sequence="794". Click the "OK" button.

Once more on the left-hand pane, click on InstallUISequence. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Condition="VersionNT < 502", Sequence="794". Click the "OK" button.

Save your work, close Orca and then test. It works great for me and I hope the information is able to help someone else avoid some of the headaches I went through trying to figure this all out.

Z

cst_user
05-15-2009, 04:36 PM
As a quick follow-up, I did finally find a solution to my problem after several days of intensive web seraching, bouncing from blog to support sites to msd and back again. I wanted to share it here for anyone else that was hoping to get an answer to the same or a similar problem.

Find and download Orca from Microsoft's MSDN web site. It's free and works wonderfully for this purpose. (I suppose one could use Wix as well, but I used Orca.)

On the General Information section of my install package, I set INSTALLDIR = "[USERS]\Product Name". This installs the application into the Users directory on Vista which gives the user read/write access to the Access database files it uses. I used Vista as the default and then modified the .msi file to use a different directory if the OS was older than Windows Server 2003.

Create your install package with ISE as normal, then open the .msi file with Orca. Click on the "Tools" menu, then click on "Options...". Click on the Database tab and then put a check mark in "Copy embedded streams during 'Save As.'. Click the "OK" button.

On the left-hand pane, click on CustomAction. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Type="51", Source="INSTALLDIR", Target="[ProgramFileFolders]". Click the "OK" button.

Back on the left-hand pane, click on InstallExecuteSequence. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Condition="VersionNT < 502", Sequence="794". Click the "OK" button.

Once more on the left-hand pane, click on InstallUISequence. In the right-hand pane, right click and chose "Add Row". This is the data I used, but you may need to modify it to fit your situation: Action="Set_InstDir", Condition="VersionNT < 502", Sequence="794". Click the "OK" button.

Save your work, close Orca and then test. It works great for me and I hope the information is able to help someone else avoid some of the headaches I went through trying to figure this all out.

Z