Install Selected COMPONENT only if .NET FRAMEWORK installed - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Install Selected COMPONENT only if .NET FRAMEWORK installed

I would like the user to have an option to only install a component if they want the functionality and have a particular installed.
For example, if the user would like to use the Teamwork feature using Vault, they need to register OurProductVault.dll
However to do so, they need the Vault client installed, which by default will ensure the appropriate version of .Net Framework is installed, that will allow registration of the dll.
My intention is to separate the OurProductVault dependencies into a separate component which by default will not be installed.
If the user elects to install the component (Vault Compatibility) I need the ability to check that the Vault Client has been installed.
If the Vault Client is not installed then the option is not permitted.
If the Vault client is installed then the option is valid and I will register the dll.

What is my best approach to achieve this requirement?

Thanks in advance.
Mark
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hi Mark and welcome to Advanced Installer Forums,

Create a new feature called VaultCompatibility (or some other name of your choice) and place the appropriate resources related to Vault Compatibility under it.
You can create a search for resources (registry keys/values or files) that indicate the presence of Vault Client on the system. Then select your VaultCompatibility feature from the Organization page and set its Conditional Install Level with a condition using the search result property created in the previous step. This way, the Vault Compatibility feature will not show up on the feature selection dialog if the search result is empty (the search failed to find VaultClient installed)

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hello Gabriel

Thank you for your reply.

What I tried to do was the following:
I created the VaultCompatibility feature and and place the appropriate resources related to Vault Compatibility under it.
I created a File Search (VAULT_INSTALLED) looking for "VaultLib.dll" in the [ProgramFilesFolder] to a depth of 2. When I test the search the "VaultLib.dll" file and full path is displayed in the results. when I remove the "VaultLib.dll" file only "1:" is displayed in the field.
On the Organization page I select the VaultCompatibility feature and select "Install the feature only if "INSTALLLEVEL" property is greater that : (and I set the value at 499)"
I selected the "Conditional install level" and created a new condition.
In the Edit condition form I selected the PROPERTY command and selected the "VAULT_INSTALLED" User Defined property. this property is displayed in the Expression field. Selecting Validate command whether the "VaultLib.dll" file is in the [ProgramFilesFolder]\Vault folder or not always returns "The condition is valid"
Selecting Ok to close the form returns me to the Edit Conditional Level form that displays the VAULT_INSTALLED condition and I set the Level to 500.
Selecting Ok to close this dialog returns me to Edit Conditional Levels dialog which list the VAULT_INSTALLED condition at Level 500.
Selecting Ok to close this dialog returns me the Feature Properties editor, with VaultCompatibility feature selected and displayed.
I save and build my project.
I perform an installation (with the VaultLib.dll" file removed) and I am able to select the VaultCompatibility feature in the custom installation dialog.
Selecting to install this feature shows no errors.
I would have expected the feature not to be displayed in the custom installation dialog.

Have I done something incorrect?

Regards
Mark
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hi Mark,

Please note that the install level for the individual feature is not related to the INSTALLLEVEL property. Only set the install level of a feature to one of the three listed values, 0(for not shown), 1(for typical install) or 4(for complete). Do not use the "Install this feature only if INSTALLLEVEL property is greater than" option, it is not needed.

Let me know if this helped.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hello Gabriel

I think I have followed your suggestions, however due to an error (see "Exception when building project") which occurs when attempting the build I am unable to confirm if it works or not.

Thank you for your help so far.

Regards
Mark
Attachments
Search test 2 (Search file does NOT exist)
Search test 2 (Search file does NOT exist)
VaultProgFolderTest.png (34.04 KiB) Viewed 7102 times
Search test (Search file does NOT exist)
Search test (Search file does NOT exist)
VaultSearchTest.png (41.06 KiB) Viewed 7102 times
Vault Compatibility Features Properties
Vault Compatibility Features Properties
VaultFeatureProps.png (99.17 KiB) Viewed 7102 times
radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hello Gabriel

I am still having difficulties in testing this technique. See post "Unable to register selected file"

Regards
Mark
radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hello Gabriel

I am not able to get the desired result using the technique you have described. I think that I dont understand the exact configuration.

What I have done is created a search.
I am searching for the the presence of regasm.exe for .Net 2
When testing the search the result is regasm.exe and is displayed in the results field. See screen capture "Search for regasm.exe"
I create a "Conditional install level" using the search. See screen capture "ConditionalExpression"
After a build and install I note that the feature is available in the custom list and is also installed by default.
This is good.
Now I change the search condition so that regasm.exe for .Net 2 is not found. I achieved this by changing the version numbers as indicated.
No result is found and this can be seen in the search results. See screen capture "No search result"
After a build and install I note that I note that the feature is still available in the custom list and is also installed.

What am I doing wrong?

Thank you

Mark
Attachments
ConditionalExpression
ConditionalExpression
Condition.png (113.73 KiB) Viewed 7046 times
NoSearchResult
NoSearchResult
NoSearchResult.png (31.12 KiB) Viewed 7046 times
Search for regasm.exe
Search for regasm.exe
DotNetSearchTest.png (28.85 KiB) Viewed 7046 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hi Mark,

I noticed that you are setting the install level to "1" and the feature is configured to be installed by default. There is nothing telling the feature to not install if the search is unsuccessful. You can configure the feature to not be installed by default. This way if the search is successful the feature install level becomes 1 and the feature is installed.

Another approach is to add another conditional install level for "0" when the search property is empty.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
radar
Posts: 10
Joined: Tue May 25, 2010 12:06 am

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hello Cosmin

Thank you for your reply.

What I want to achieve is install the feature by default if .Net 2 is installed.
I really do not understand how this hangs together. I have read the help and do not understand what I need to do.

There appear to be 3 areas of configuration
1. - Installation behavior (i.e. by default install the feature)
2. - Conditional Levels
What is return from the condition. Is it true, false or something else. Does it mean if true then level 1?
3. - Condition
If the search is unsuccessful, what is the state of the expression? Is it true, false or something else.

I'm sorry, but I am a little confused here.

Regards
Mark
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Install Selected COMPONENT only if .NET FRAMEWORK installed

Hi Mark,

All conditions are evaluated as true or false. If true, the specified install level is used for the feature. If false, the feature is not affected and it uses the default behavior.

The installation behavior specifies what happens by default with the feature, if it's installed or not. A conditional install level modifies this behavior based on a condition.

For example, if a feature is installed by default you can conditionally set install level 0 to skip the feature. If the condition is true, the install level becomes 0 and the feature is not installed. If the condition is false, the feature is not affected, so it uses the default behavior (it's installed). The same logic is applied for Not installed by default and install level 1.

Conditional install levels simply modify the default feature behavior based on a condition.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”