Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > CustomActionData property to get the setup name
 

CustomActionData property to get the setup name

Hi I have 2 setup projects for my product and one installer class. I am trying to find a customactiondata property to use in order to detect which setup is being run. For example in my code I want to say: If the property value is setup1.msi then do this.... else if property value is setup2.msi then do this ......

I have not been able to find the right property yet - any help will be appreciated, thanks.
IT_Graduate  Monday, August 17, 2009 11:30 AM
Yes that's the same as well. I've been looking at all properties here:

http://msdn.microsoft.com/en-us/library/aa370905(VS.85).aspx

The nearest I've come to is/originaldb="[OriginalDatabase]" and using it in my code like this:

protected override void OnBeforeInstall(IDictionary savedState)

{

base.OnBeforeInstall(savedState);

StringDictionary myStringInput = this.Context.Parameters;

if (myStringInput != null)

{

foreach (DictionaryEntry d in myStringInput)

{

if (d.Key.ToString() == "OriginalDB")

{

if (d.Value.ToString().Contains("Setup1"))

{

}

}

}

}

}

  • Marked As Answer byIT_Graduate Monday, August 24, 2009 8:23 AM
  •  
IT_Graduate  Thursday, August 20, 2009 8:38 AM
You could pass [ProductName] - that's the name of the product from the setup project's property pages.

Since you have two different setups, I don't see why your first setup project can't just pass /setup=setup1 and the other one pass /setup=setup2 because that's in the CustomActionData in each setup project, then your installer class can just get the value of the "setup" dictionary key.
Phil Wilson
PhilWilson  Monday, August 17, 2009 6:16 PM
Thank you for your reply however, the ProductName property is the same for each Setup.

Also, I cannot use your second proposed solution as I am using a merge module that has the customactiondata and then using the primary output of the merge module in each setup.
IT_Graduate  Tuesday, August 18, 2009 9:18 AM
How about the [ProductVersion] property? Is that the same too?
Phil Wilson
PhilWilson  Wednesday, August 19, 2009 6:31 PM
Yes that's the same as well. I've been looking at all properties here:

http://msdn.microsoft.com/en-us/library/aa370905(VS.85).aspx

The nearest I've come to is/originaldb="[OriginalDatabase]" and using it in my code like this:

protected override void OnBeforeInstall(IDictionary savedState)

{

base.OnBeforeInstall(savedState);

StringDictionary myStringInput = this.Context.Parameters;

if (myStringInput != null)

{

foreach (DictionaryEntry d in myStringInput)

{

if (d.Key.ToString() == "OriginalDB")

{

if (d.Value.ToString().Contains("Setup1"))

{

}

}

}

}

}

  • Marked As Answer byIT_Graduate Monday, August 24, 2009 8:23 AM
  •  
IT_Graduate  Thursday, August 20, 2009 8:38 AM

You can use google to search for other answers

Custom Search

More Threads

• How to change Welcome to the Setup Wizard banner Location
• Deployment of .net Application causing MS Office App Crashes
• Database location problem
• ClickOnce installation fails on guest account
• Clickonce deployment and Obfuscation
• URGENT: Install from CD and update from Internet
• Customize Error Message?
• Form Resizing
• how to add the outlook express addin into the project file?
• How to deploy application with "custom setup prerequisites"?