cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
codedude
Level 2

Dynamic Virtual Directory Naming

Hi,

We have a .Net web application for which we are trying to implement an InstallShield installer for. We would like to offer the end user the ability to enter in a name for the web application/virtual directory, in addition to allowing them to select the content directory. We are currently using InstallShield 2011 - Premier Edition. I have created a dialog in which to capture this information, which gets applied to my own properties:

  • VIRT_DIR_NAME
  • MY_CONTENT_DIR_NAME


I have applied one of these to the settings in the Internet Information Services view, and set the name of the application to: [VIRT_DIR_NAME]

It does not seem to utilize that property at all. It just creates a folder in the IISRootFolder that matches what is set in the Files and Folders view. It doesn't even create an application, but instead a Virtual Directory which is also odd. If I change the folder in the Files and Folders view to [VIRT_DIR_NAME], it literally creates a folder named "[VIRT_DIR_NAME]".

I'm wondering if there is a way to apply the virtual directory name, and content directory names dynamically through dialogs, and if so, could someone please explain how or perhaps point me to set of instructions/docs for it?

I have not found an explicit means of completing this in the InstallShield documentation, and searching the forums has led to either unanswered threads about this topic or threads that point to expired links. Only a few threads have some basic insight which seems to be what I have attempted.

Any help would be greatly appreciated.
Labels (1)
0 Kudos
(2) Replies
andyamstrad
Level 6

The way to do this in not to use Installshields IIS view and to write your own IIS functions for creating, deleting the virtual directory etc.

Example snippet:

set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
//check object instantiated
if (IsObject(objIIS_Root)) then
//set virtual directory object
set objVirtDir = objIIS_Root.Create("IISWebVirtualDir", strVirtDir);
//check virtual directory object instantiated
if (IsObject(objVirtDir)) then
//aet virtual directory settings
objVirtDir.Path = strVirtDirPath;
objVirtDir.AppFriendlyName = strVirtDir;
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;
objVirtDir.AspScriptTimeout = 900;
objVirtDir.AppCreate(TRUE);
objVirtDir.SetInfo();
endif;
endif;
0 Kudos
Harold_Olsen
Level 2

I stumbled upon a more elegant way of doing this (in Installshield 2011) by mistyping a few string and property names. Many values are created as STRING variables, NOT PROPERTIES regardless of their localization. PROPERTIES on the other hand can refer to strings or not, but cannot be directed referenced by some fileds in the project editor. The workaround for this depends on the way substitution is done given an entry that must be a string, such as a VirtDir or VirApp name:
1 Create a PROPERTY to contain the real name, such as VIRTAPPPROP
2 Now create a string that references the property, such as VIRTAPPSTR. Yes, you can do this but be VERY careful of circular references
3. Give the string the value of [VIRTAPPPROP]
4. In the field editor for the name, use the pull down to find and select the predefined string, and use it for the value.

Now you can define the proery dynamically (before its used of course) AND have it substituted into an otherwise untranslated field.
0 Kudos