William
Posts: 1
Joined: Fri Jul 17, 2009 11:20 am

Need some help in Virtual Directory

I have a question regarding Virtual Directory in IIS. First of all, my installer will let me browse the directory where my folder will be installed at, followed by the "Folder's Name". Next, the "Folder's Name" will be passed into the "Alias" name field in IIS Virtual Directory as well as the "Folder's Directory" path into the "Directory", these processes will be executed "Automatically" and "Hidden".

Let's say a scenario where, a new user were trying to install my system to his computer, first of all, he choose the path and enters the folder's name, says "MySystem". Next, the folder's name "MySystem" will be passed into the "Alias" field as well as the "Folder's Directory".

In the end, "MySystem" will appear under IIS -> (Local Computer) -> Web Sites -> Default Web Site -> MySystem

Is it possible that the folder's name and directory can become something like a parameter rather than a constant value? Example, i type the name of the Virtual Directory under IIS page manually in "Advanced Installer "but this approach will be wrong when user trying to type in a different folder name during the installation.

Can anybody help me please ? Need to get it done urgently :(
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Need some help in Virtual Directory

Hi,

The virtual directory name can be set to an installer property. This property can be set during installation to anything you want (it's dynamic). So if the property is set to "MyNewSystem", the virtual directory name will be set to "MyNewSystem". If the property is modified, the virtual directory name is also modified.

The installation path selected by the user will be stored in the APPDIR property. This property can be parsed in order to obtain the folder name (the name of the virtual directory). Here is some sample VBScript code:

Code: Select all

Dim installPath
Dim tokens

' get the install path
installPath = Session.Property("APPDIR")
tokens = Split(installPath, "\")

' initialize the path lenght and the custom path
Dim index
Dim parentLenght
parentLength = UBound(tokens) - 1

' go through the path until the folder name is reached
For index = 0 To parentLength
    If Not(tokens(index)) = Empty Then
      customPath = customPath & tokens(index) & "\"
   End If
Next

Dim name
name = tokens(index - 1)
Session.Property("FOLDER_NAME") = name 
This code can be pasted into a .VBS file which can be added as a New Attached Custom Action in the Custom Actions page. After it runs, the FOLDER_NAME property will be set to the name of the target folder. For example, if the installation path is "C:\Program Files\Your Company\Your Application", the property will be set to "Your Application".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mhatkinson
Posts: 32
Joined: Tue Apr 08, 2008 5:36 pm

Re: Need some help in Virtual Directory

Sounds reasonable...so how would you then make the value in a FOLDER_PROPERTY or DYNAMIC_VIRTUAL_DIR actually become the name of the virtual directory?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Need some help in Virtual Directory

Hello,

You can set the name of the Virtual Directory's tree item to "[FOLDER_PROPERTY]" just like in the attached image.

Regards,
Gabriel
Attachments
Untitled.png
Untitled.png (9.13 KiB) Viewed 6844 times
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
ysliew
Posts: 14
Joined: Thu Dec 17, 2009 5:09 am

Re: Need some help in Virtual Directory

Hi,

I have tried to set the Virtual Directory's tree item to [FOLDER_PROPERTY] and [FOLDER_NAME], but both are not working, and the following error is shown.

Kindly advise, thanks.
Attachments
error1.png
error1.png (9.5 KiB) Viewed 6835 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Need some help in Virtual Directory

Hi,

I'm not sure why you are encountering this behavior. Can you please send us the .AIP (project) file you are using and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ysliew
Posts: 14
Joined: Thu Dec 17, 2009 5:09 am

Re: Need some help in Virtual Directory

Hi Cosmin,

I have sent the aip project file and installation log.

Kindly advise, thanks.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Need some help in Virtual Directory

Hello,

The problem resides in the property you set as a Virtual Directory name in your project. Details about the issue can be found in my reply from the following thread:
http://www.advancedinstaller.com/forums ... 259#p27530

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”