johngraumann
Posts: 11
Joined: Fri Jan 04, 2008 12:14 am

Create virtual directory based on selected feature

Using Advanced Installer 6.1:

I have a setup project containing two distinct features. One feature is a web application, and the other is a standalone application not requiring IIS. I would like to conditionally create a virtual directory for the web application based on whether or not the web application feature is being installed. I have added the following condition for the web application feature (MYWEBAPP) in the Install Condition field for the virtual directory:

(&MYWEBAPP = 3) OR (&MYWEBAPP = 2)

This appears to work when installing the product for the first time, or when removing the product entirely. If I select the MYWEBAPP feature during install the virtual directory is created properly, and if I have not selected it, the virtual directory is not created, as expected. Either way, it is removed properly on uninstall.

However, if I do not install MYWEBAPP during the first install, there does not seem to be a way to get the virtual directory created if I later *modify* the installation and add the MYWEBAPP feature (conversely, if I remove the MYWEBAPP feature only, the virtual directory remains).

Looking at the MSI file in Orca, it appears that the condition I added for virtual directory creation is never even evaluated during a modification, as it is superseded by a higher level IIS condition that only evaluates to true if we are doing a first time install or a complete removal.

Is there any other way to create/remove a virtual directory when a feature is being installed, regardless of whether or not it is a first time install?

Thanks.
John
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

To accomplish what you need you must edit the MSI with Orca by following these steps:
- in Orca go to the "InstallExecuteSequence" table and select the AI_IIsInstall action
- set its Condition to: (VersionNT >= 500) AND (REMOVE <> "ALL")
- select the AI_IIsUninstall action
- set its condition to: (VersionNT >= 500) AND (REMOVE)
- save and run the MSI

Also, I have added on our TODO list a feature which will allow this to be done from the Advanced Installer project.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
johngraumann
Posts: 11
Joined: Fri Jan 04, 2008 12:14 am

Excellent. You pointed me in the right direction. What I actually ended up doing was to do this:

Changed the AI_IIsInstall condition to this:

(VersionNT >= 500) AND (&MYWEBAPP = 3)

Changed the AI_IIsUninstall condition to this:

(VersionNT >= 500) AND (&MYWEBAPP = 2)

This way, the IIS virtual directory creation gets run any time the MYWEBAPP feature is being installed, and the removal gets done anytime the MYWEBAPP feature is being removed. This appears to work in all cases (full install, full removal, and install/removal of the single feature through the modify dialogs).

The ability to attach the IIS virtual directory creation to a specific feature in this manner would be much appreciated in future versions.

Thanks!
liorbk
Posts: 13
Joined: Tue Apr 08, 2008 2:44 pm

Re: Create virtual directory based on selected feature

Hi,
I'm using Version 6.3, and it seems that the problem still exist.
Is that so?
If yes, is there another walkaround that doesn't involves using orca? If I must use orca, is there a way to do this update automaticliy during a build process.
Our build is automatic and updating the orca manually is not an option for me.

By the way, I need not only the IIS virtual directory creation to be attached to a feature but also running SQL script. Is this also not possible.

Thanks,

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

Re: Create virtual directory based on selected feature

Hi,
I'm using Version 6.3, and it seems that the problem still exist.
Please note that this limitation makes sure that the IIS settings in the package are not reinstalled during Maintenance. However, the 6.2 version of Advanced Installer brought some improvements which allow you to edit the AIP to set the condition of the IIS installation (instead of editing the MSI file).

In this case, you can open the AIP file in a text editor, find the "caphyon.advinst.msicomp.MsiInstExSeqComponent" component and edit the condition of the "AI_IIsInstall" custom action. Note that this condition is for the custom action which installs the IIS settings in the package, not for a virtual directory or a website. You can condition a virtual directory or a website by using the built-in support in Advanced Installer:
Website settings
Virtual Directory settings
I need not only the IIS virtual directory creation to be attached to a feature but also running SQL script
I'm not sure I understand what you mean. Can you please give me more details about this?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
liorbk
Posts: 13
Joined: Tue Apr 08, 2008 2:44 pm

Re: Create virtual directory based on selected feature

Thanks for the reply. I will explain what I'm tring to do:

One of the feature in my installation can only be installed if IIS 5.1 is installed on the machine.
Since I can't redistribute IIS 5.1 (right?!) and since I do want to make it possible to install the rest of the software even thought IIS is missing, I spillted the content into two features.
The second feature contains the directory of the web application. I also need to create a virtual directory for that directory on IIS. I also need to run some SQL scripts that relates to the web app.

What I did:
- I created a search for the IIS Version in the registry. (to property called IIS_VERSION)
- Depending on that search I created install level condition for the second feature. I set the level to 0 if the version is not 5.1 and 9 if it is.
- I added the condition to the SQL script and the virtual directory creation depending on the IIS_VERSION property (from the search).

Result:
Clean install works as planned. (Though I didn't really understood the correct way to use the level condition - It took me a while and I still think I didn't use it correctly)
When modifing installation after IIS was installed - the files are added, but the virtual directory isn't created and the sql scripts does not run.

What can I do to solve this?
Does editing the AIP as you suggested would help? Can it be done via command line?

Thanks,
Lior
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Create virtual directory based on selected feature

Hi,
When modifing installation after IIS was installed - the files are added, but the virtual directory isn't created and the sql scripts does not run.
When you modify the installation, is the condition of the IIS virtual directory and SQL Scripts met? Can you please send us the AIP you are using to support at advancedinstaller dot com so we can see how you configured it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ashtilman
Posts: 8
Joined: Mon Mar 28, 2011 6:43 pm

Re: Create virtual directory based on selected feature

Hi,

I have exactly the same problem in version 8.0.2. the web site is not added when I run a modify process.

when I change the AI_IISinstall based on the recommendation in the forum it adds the site but then the sites are not removed in an uninstall... any ideas?

thanks
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Create virtual directory based on selected feature

Hi,

Can you please send us on support at advancedinstaller dot com the aip file and a verbose log created during uninstall to see what happens?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ashtilman
Posts: 8
Joined: Mon Mar 28, 2011 6:43 pm

Re: Create virtual directory based on selected feature

Hi,

I sent the files

thank you!
davhe
Posts: 1
Joined: Thu Nov 29, 2012 4:56 pm

Re: Create virtual directory based on selected feature

Hi,
having same kind of problem, got it working for AI_iisInstall but problem with Ai_IISUninstall,
scenario:
1.) Got 5 IIS websites to be deployed (defined in IIS Tab)
2.) Install all 5 websites.
3.) Re-run the installer -> go to modify -> uncheck features (iis website) -> click modify.
4.) Result: All unchecked features are uninstalled BUT the Virtual Application is not removed in IIS.
5.) Tried using condition (VersionNT >= 500) AND ((REMOVE="ALL") OR (&feature = 2))
6.) The iis uninstall is executed BUT ALL Virtual Application defined by the installer is removed.

Is there any fix for this or did I setup my condition wrong?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create virtual directory based on selected feature

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can proceed like this:
- Go to "Table Editor" page, select "InstallExecuteSequence" table and edit the "Condition" field, corresponding to "AI_IIsUninstall" row, like this:

Code: Select all

(VersionNT >= 500) AND ((REMOVE="ALL") OR (AI_INSTALL_MODE = "Change"))
- Build and run your project.

Also, please keep in mind that our "Table Editor" feature is available only in an "Enterprise" or above license.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”