cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pmatlock
Level 6

UI similar to WI Web Setup Project

I am looking to build a UI very similar to the UI that comes automatically with the Windows Installer Web Setup project. I need a UI that gives drop-downs of the available IIS websites, virtual directories, and application pools.

I see that you can run an IISScan.exe to import into your IS project, yet that doesn't help me at run-time.

Any help/direction would be greatly appreciated.
Labels (1)
0 Kudos
(12) Replies
wierdling
Level 3

pmatlock,

I just did something like that. I ended up creating a .net dll that loads the list websites on the machine, and used that to set the target website. For the virtual directory name, I just have an edit text box with a value pre-filled with what I want, but that allows the end user to change it if they want.

If you want to give that a shot, I can post my code for the .net dll and my installscript script that sets everything.
0 Kudos
pmatlock
Level 6

If you could post post that code, that would be wonderful!
0 Kudos
wierdling
Level 3

Here is the installscript (it is part of the OnFirstUIBefore method):

Dlg_SdSelectWebSite:
if (nSetupType = CUSTOM) then
szSelectWebSiteDialog = "sdSelectWebSite2";
szDllName = SUPPORTDIR ^ "ExistingWebSites.dll";
szTemp = "ExistingWebSites.WebSites";
nvSize = MAX_PATH;
set myDllObject = DotNetCoCreateObject(szDllName, szTemp, "");
webSitesList = myDllObject.ListSites();
listId = ListCreate(STRINGLIST);
StrGetTokens(listId, webSitesList, "~");
MsiGetProperty(ISMSI_HANDLE, "VIRTUALDIRECTORY", svVirtualDirectory, nvSize);
EzDefineDialog(szSelectWebSiteDialog, ISUSER, szSelectWebSiteDialog, 0);
bDone = FALSE;
while(!bDone)
nControl = WaitOnDialog(szSelectWebSiteDialog);
switch(nControl)
case DLG_INIT:
CtrlSetText(szSelectWebSiteDialog, 1304, svVirtualDirectory);
CtrlSetList(szSelectWebSiteDialog, 1306, listId);
CtrlSetCurSel(szSelectWebSiteDialog, 1306, "Default");
case 12: // back
nResult = BACK;
bDone = TRUE;

case 1: // next
CtrlGetText(szSelectWebSiteDialog, 1304, svVirtualDirectory);
CtrlGetCurSel(szSelectWebSiteDialog, 1306, szTemp);
nvWebSiteNumber = myDllObject.FindWebSiteNumber(szTemp);
NumToStr(szTemp, nvWebSiteNumber);
MsiSetProperty(ISMSI_HANDLE, "TARGETVDIR", szTemp);
MsiSetProperty(ISMSI_HANDLE, "VIRTUALDIRECTORY", svVirtualDirectory);
bDone = TRUE;

case 9:
nResult = CANCEL;
bDone = TRUE;
endswitch;
endwhile;

EndDialog(szSelectWebSiteDialog);
ReleaseDialog(szSelectWebSiteDialog);
ListDestroy(listId);

if (nResult = BACK) goto Dlg_SdFeatureTree;
if (nResult = CANCEL) then abort endif;
endif;
nResult = 0;


I have attached the custom dialog and .net project I used. In installshield, I setup a new website under the Server Configuration->Internet Information Services. The name of it is the property [VIRTUALDIRECTORY] (see attached screenshot).

Let me know if I didn't explain something correctly.





0 Kudos
pmatlock
Level 6

Thanks very much. I will give this a try 🙂
0 Kudos
pmatlock
Level 6

wierdling,

Thanks again for this awesome example!!

I did have one question regarding the InstallScript and incorporating the .dll methods.
I noticed you utlilized the DotNetCoCreateOjbect(), versus the InstallShield's UseDLL() functionality...was there any particular reason or pros/cons to that?

I've not used either one, so just asking out of curiosity.
0 Kudos
wierdling
Level 3

I used the DotNetCoCreateObject so I could make calls directly to it without having to prototype anything (I am lazy 🙂 )
0 Kudos
pmatlock
Level 6

Did you encounter any problems using the DotNetCoCreateObject function?
My call to the dll.method crashes...
0 Kudos
pmatlock
Level 6

Never mind 🙂 I figured out I had to make my .dll COM Visible
0 Kudos
wierdling
Level 3

Posting this for anyone else who reads this thread:

Make the .net dll 2.0 (not 3.5).
0 Kudos
pmatlock
Level 6

I was successful with my dll created under the .NET Framework 3.5...just had to change the ComVisible(true) in the AssemblyInfo.
0 Kudos
pmatlock
Level 6

Taking this one more step...did you create new website or new webapplication via C#(dll) code or did you do this via InstallScript code?

I'm just investigating the best way to handle working with IIS functions.

Thanks for the great info on this.
0 Kudos
alokk_77
Level 2

Hi,

We are using installshield 12 for creating web setup. As you uploaded custom dialog file and Dotnet dll for select website to install web site. We are unable to add the same in our web project. Can you plz guilde us,How to add this files in the web project.
0 Kudos