Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setup project: custom actions

Status
Not open for further replies.

baboudi

Technical User
Oct 18, 2007
34
GB
Hi all,

I have been struggling with this for a while without success.
I need to deploy an access application and moving awayfrom the Ms Access Package Wizard.

To be able to create the shortcut target with the right path, I need to check which version of access is installed.
I set up a launch condition on Windows Installer Search for both Access 2003 and 2007.

I then created a custom action on Install to retrieve the path using:
/Access2003="[ACCESS2003]\" /Access2007="[ACCESS2007]\" /TargetDir="[TARGETDIR]\"


I also have the installer class with the setup project.

When I run it on a client with Access 2003 only, it will fail with:
Error 1001. Exception occurred while initializing the installatio: System.ArgumentException...
If the parameter is used as an installer option, the format must be /key=[value]

If I removed the Access2007 bit, the installation run successfully. Same thing will happen on a client running access 2007. I need to remove the /Access2003="[ACCESS2003]\" bit for the installation to work


It seems that if the search returns false and the path is empty the installation will fail
In the installer class I tried to ensure that the parameter exists before using it. If I understand the help properly, the property is not created if the value is not found.

const string Access2003 = "Access2003";
const string Access2007 = "Access2007";

if (Context.Parameters.ContainsKey(Access2003))
Access2003_Path = Context.Parameters[Access2003];


if (Context.Parameters.ContainsKey(Access2007))
Access2007_Path = Context.Parameters[Access2007];



Any help will be greatly appreciated, as I run out of ideas as to make it work if a version is not found

Benwa
 
realised that I was missing ==true in my if statements but still failing

if (Context.Parameters.ContainsKey(Access2003)==true)
Access2003_Path = Context.Parameters[Access2003];


if (Context.Parameters.ContainsKey(Access2007)==true)
Access2007_Path = Context.Parameters[Access2007];

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top