phil.durand
Posts: 5
Joined: Thu Oct 09, 2014 8:20 pm

Creating a basic IIS web application into a virtual path

Using Advanced Installer 11.5 on Windows 8.1 with IIS 7.5

We seem to have problems performing basic setup of an ASP.NET IIS application using Advanced Installer, and the Help Documentation is extremely lacking in explanation of how things work.

First off, we created a simple ASP.NET application installer which has files and adds the wizard to select from a website/virtual directory. However, in the end, the site is installed in the site/folder that is defined in the IIS section, and NOT the one that the user has selected from the BrowseIISWebsitesDlg that was added.

Also, we want the user to be able to choose the virtual directory path to install into (even if it does not exist). So essentially, they pick the website, and then they TYPE in the virtual directory path (with slashes, so multiple folders deep if necessary), and then the Advanced Installer needs to create the appropriate virtual directory and then install the web application in there.

So the user would select for example:

Website: Default Web Site
Virtual Directory: Some\Folder\In\The\Site
Application Name: MyApplication

And then it simply installs the application in Default Web Site\Some\Folder\In\The\Site\MyAPplication

And done!

For some reason, we do not see any way for this to occur so far with the interface of Advanced Installer. Right now, we can't even get it to install an application named "MyApp" in the site that the user selects.... I've read a few forums posts about doing custom actions and playing with properties and this and that, none of it spelled out easily enough to understand, but again why do you have to go through hoops to install a web application?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Creating a basic IIS web application into a virtual path

Hello Phil and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

First of all I apologize for my delayed reply.

You can achieve what you want by using a similar approach like the one exposed in our "Browse for IIS Web Sites & Virtual Directories" and "Install IIS website specified by the user" articles. However, in order to implement the requested scenario you need to workaround a bit. For your scenario basically you need to get the physical path and web site name of the selected web site in the "IISBrowseComboBox" combo box populated by our "BrowseIIS" custom action. Then, you should store the web site name and physical path of the selected web site in your own custom installer properties and use these properties to create property-based folders to which will pinpoint the IIS items (web site, web app and virtual directory) added in "IIS" page.

Here are a detailed step by step description:
1. go to "Install Parameters" page and enable the "Run as administrator" option
2. add the following properties in the "Properties" section: MY_VIRTUALDIRECTORY, MY_VIRTUALDIRECTORY_PATH, MY_WEBAPP_NAME, MY_WEBAPP_PATH, MY_WEBSITE_NAME, MY_WEBSITE_PATH, OUTPUT_NAME, OUTPUT_PATH.
3. go to "Files and Folders" page and create three property-based folder using the MY_VIRTUALDIRECTORY_PATH, MY_WEBAPP_PATH, MY_WEBSITE_PATH properties
4. add your web application files under MY_WEBAPP_PATH folder
5. go to "Custom Actions" page and add three "Set installer property" predefined custom actions with sequence, scheduled after "Wizard Dialogs Stage -> Searches" actions group, like this:
  • Property: MY_VIRTUALDIRECTORY_PATH
    Value: [WindowsVolume]

    Property: MY_WEBAPP_PATH
    Value: [WindowsVolume]

    Property: MY_WEBSITE_PATH
    Value: [WindowsVolume]
6. go to "Dialogs" page and create a "BrowseIIS" new dialog containing a combo box control with the "IISBrowseComboBox" property associated
7. go to "IIS" page and launch the "Browse Web Sites & Virtual Directories" wizard from the IIS toolbar
8. during the wizard choose the "BrowseIIS" as display dialog, "List only Web Sites on the IIS server", "Show detailed information about each IIS entity listed, ..." and "Output mode -> physical path"
9. go to "Dialogs" page and select the "BrowseIIS" dialog
10. in the "Init Events" tab, under the existing events in the list, add the following events:
  • Control Event: Set installer property value
    Property: OUTPUT_PATH
    Argument: [IISBrowseOutput]
    Condition:

    Control Event: Set installer property value
    Property: IISBrowseOutputMode
    Argument: 0
    Condition:

    Control Event: Execute custom action
    Argument: BrowseIIS
    Condition: 1 AND 1

    Control Event: Set installer property value
    Property: OUTPUT_NAME
    Argument: [IISBrowseOutput]
    Condition:
11. select the [Next >] button and in its "Published Events" tab, under the existing events in the list, add the following events:
  • Control Event: Set installer property value
    Property: MY_WEBSITE_NAME
    Argument: [IISBrowseSelectedValue]
    Condition:

    Control Event: Set installer property value
    Property: IISBrowseOutput
    Argument: [OUTPUT_PATH]
    Condition:

    Control Event: Execute custom action
    Argument: IISDecodeBrowseResult
    Condition:

    Control Event: Set installer property value
    Property: MY_WEBSITE_PATH
    Argument: [IISBrowseSelectedValue]
    Condition
12. after the "BrowseIIS' dialog create a new dialog containing two edit box controls (MY_VIRTUALDIRECTORY and MY_WEBAPP_NAME) where the user can enter the virtual directory path and web application name
13. on the [Next>] button, in its "Published Events" tab add the following events:
  • Control Event: Set installer property value
    Property: MY_VIRTUALDIRECTORY_PATH
    Argument: [MY_WEBSITE_PATH]\[MY_VIRTUALDIRECTORY]
    Condition

    Control Event: Set installer property value
    Property: MY_WEBAPP_PATH
    Argument: [MY_VIRTUALDIRECTORY_PATH]\[MY_WEBAPP_NAME]
    Condition
14. go to "IIS" page and add the desired web site, web application and virtual directory by using in their "Name" and "Folder" fields the MY_WEBSITE_NAME, MY_WEBSITE_PATH, MY_WEBAPP_NAME, MY_WEBAPP_PATH and MY_VIRTUALDIRECTORY_PATH properties

15. build and test the installation project

Also, I've attached a sample created with AI 11.5.1 version which implements a similar scenario.
sample.zip
(5.6 KiB) Downloaded 397 times
If you have any further questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
phil.durand
Posts: 5
Joined: Thu Oct 09, 2014 8:20 pm

Re: Creating a basic IIS web application into a virtual path

Thank you muchly for these instructions!

I'm going to test this out and see if this works to fit for what I described. I had sort of come up with a solution that was close to this (but not as elaborate on the actual folder things get installed, i ended up with fake folders for the virtual directory which can create a bit of a mess).

I will reply when I've given this a try.

:D
phil.durand
Posts: 5
Joined: Thu Oct 09, 2014 8:20 pm

Re: Creating a basic IIS web application into a virtual path

The project sample you sent me cannot be opened.

It says "The project fragment was created using a newer version of Advanced Installer and cannot be open"
phil.durand
Posts: 5
Joined: Thu Oct 09, 2014 8:20 pm

Re: Creating a basic IIS web application into a virtual path

Got that sorted out thanks.

After looking at the sample you sent me, I can see there was some misunderstanding of the requirements maybe?

I see that you have created in the IIS tab, a structure as follows:

Sites->[MY_WEBSITE_NAME]->[MY_WEBAPP_NAME]->MY_VIRTUALDIRECTORY

This would create a web app in the ROOT of the site, and then a folder called "MY_VIRTUALDIRECTORY" inside that.

First off, the name "MY_VIRTUALDIRECTORY" is certainly not acceptable as a folder name in any site, noone would want this. But on top of that, it seems you are creating a virtual directory INSIDE the web appliation itself. So the folder structure would end up being (in IIS):

\[MY_WEBSITE_NAME]\[MY_WEBAPP_NAME]\MY_VIRTUALDIRECTORY

And what we were looking for was:

\[MY_WEBISTE_NAME]\[SOME_VIRTUALDIRECTORY_PATH]\[MY_WEB_APP_NAME]

The [SOME_VIRTUAL_DIRECTORY_PATH] being X number of folders, meaning unlimited number of folders.

Many of our customers have their sites installed in a virtual folder hierachy, which allows them to install web applications categories in many subfolders of virtual directories.

Like:

\Default Web Site\Testing\Geology\[MY_WEBSITE_NAME]

or

\Default Web Site\Testing\Geology\Browser\[MY_WEBSITE_NAME]

So if we want our installer to allow installing into one of these virtual directories, they need to be able to nest down to MANY subfolders, not just 1. And the virtual directory may or may not exist.

Am I making myself more clear in this post?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Creating a basic IIS web application into a virtual path

Hello Phil,
First off, the name "MY_VIRTUALDIRECTORY" is certainly not acceptable as a folder name in any site, noone would want this.
You can rename the name of your virtual directory to everything you want. Just go to "IIS" page, select your virtual directory item and set the "Name" field from "Basic Directory Settings" tab to a desired value. Also, you can add in the "Name" field a formatted reference of an installer property (i.e. MY_VIRTUALDIRECTORY_NAME) which is set at install time (e.g. by using an edit box control added on a dialog).
But on top of that, it seems you are creating a virtual directory INSIDE the web appliation itself. So the folder structure would end up being (in IIS):

\[MY_WEBSITE_NAME]\[MY_WEBAPP_NAME]\MY_VIRTUALDIRECTORY

And what we were looking for was:

\[MY_WEBISTE_NAME]\[SOME_VIRTUALDIRECTORY_PATH]\[MY_WEB_APP_NAME]
In order to achieve this you should simply delete the exiting web application and virtual directory items from "IIS" page and re-add them in the desired hierarchy. For example you can select the "[MY_WEBSITE_NAME]" website and from its context menu choose "New Virtual Directory". Then using the "New Web Application" context menu option of the above added virtual directory you should also add your web application.

Also, I've modified and attached the previous sample so it implements the scenario.
sample.zip
(5.66 KiB) Downloaded 370 times
So if we want our installer to allow installing into one of these virtual directories, they need to be able to nest down to MANY subfolders, not just 1. And the virtual directory may or may not exist.
Yes, this is possible. In order to achieve this you should just set at install time the "Virtual Directory Nested Path" text box from "NewDialog" to a desired nested path. For example you could set the above text box to a "FirstFolder" path or to a "FirstFolder\SecondFolder\" value and so on. If you want to add browse for folder functionality to your setup project you should take a look on our "Browse For Folder" article.

Let us know if this helped, otherwise please give us a more detailed example (maybe attach some screenshots) about your specific scenario.

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

Return to “Common Problems”