Hi all,

This is kind of an offshoot of a recent IS post of mine. Since InstallShield doesn't appear to handle installing a web application to an existing web site, I have to work around it somehow.

What I would like to do is create a custom action .dll that will query the web site names on a target machine. I would then like to take this return and populate a UI dialog control with the list for user choice. Does anyone know how I can attack populating these choices in the dialog at runtime, if possible at all. I'm not to concerned with the mechanism of grabbing the web site names, but rather the broader concept of just populating a control with list returned from a .dll custom action.

Also, can such a custom action be written in VB.NET or do I have to or should I use C.

Maybe there is a Windows Installer property that is already being populated with this information. ?? That would be very sweet.

Any help with this would be greatly appreciated.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
most people tend to create a new table by the name of ComboBox and load the results of your IIS metabase lookup into the ComboBox table as a temporary store.

I will have samples of the entire process in vbs somewhere.

My advice would be to do it in C++. If you download the WiX source files and crack open the WiXCA project you will have plenty of samples of how to write the code in C++

They typically follow a pattern of

schedule
execute
commit / rollback

Where schedule will typically handle the CAD transfer across to the deferred phase etc. (your case you wont need the schedule)

But it will at least describe how to read / write the data into various locations.

As far the metabase loading goes you do not commit the MSI that is written and as such the combobox table will not be updated for the next use. It acts in a temporary storage capacity.

I will try to dig up the code tonight for the metabase etc in vbs.
Answered 08/07/2011 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
Answered 08/07/2011 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
I'm actually using the WiX VB.NET Custom Action project type to code the custom action. What I'm currently trying to do is just use a dummy array as source for the ListBox table. I'll go back later and cycle through the web sites later (baby steps [:D]). However, my current code is failing with a 1723 error and I can't really debug it. As soon as it hits the action it blows out. Here is the code if anyone can see a problem....

Public Shared Function GetSites(ByVal session As Session) As ActionResult

Dim recListBox As Record
Dim intIndex As Integer
Dim sqlView As View
Dim strTest As String() = {"One", "Two", "Three"}

Try
session.Log("Populating Web Stite List...")

sqlView = session.Database.OpenView("SELECT * FROM 'ListBox'")

sqlView.Execute()

For intIndex = LBound(strTest) To UBound(strTest)
recListBox = session.Database.CreateRecord(4)

recListBox.SetString(1, "WEBSITECHOICES2")
recListBox.SetInteger(2, intIndex + 1)
recListBox.SetString(3, strTest(intIndex))
recListBox.SetString(4, strTest(intIndex))

sqlView.Modify(ViewModifyMode.InsertTemporary, recListBox)

Next

sqlView.Close()

session.Log("Web Site List populated successfully.")

'Everything good...
Return (ActionResult.Success)

Catch ex As Exception
session.Log("Error: There was a problem populating web site list.")
Return (ActionResult.Failure)

End Try

End Function
Answered 08/09/2011 by: Superfreak3
Black Belt

Please log in to comment
0
I think I may have found some of my problem…

I didn’t have <CustomAction()> _ above the function I send earlier. Also, in my query I had ‘ListBox’ instead of `ListBox`.

So, after making the above changes I can see my array element values in the list box.

Now it’s off to cycling through the web sites to see if I can get that to work. Once all that is up and running, I may inquire as to the high level steps of creating a virtual directory/application installation in WiX. After I get these UI changes squared away my plan is to dump the files and do all of the messy IIS setup (to handle IIS 6 & 7) in a custom action at the end of the install. Is that basically the high level goals of doing this with WiX?

Thanks for the help so far!!
Answered 08/09/2011 by: Superfreak3
Black Belt

Please log in to comment
0
One more thing I noticed, session.log statements are not reflected when I generate a log from the command line.
Where should I be seeing these log status messages?
Answered 08/09/2011 by: Superfreak3
Black Belt

Please log in to comment
0
Trying to code the site name grab now, but whatever I try I receive an “Unknown error (0x80005000).

Here’s the most recent code I’ve tried….

Try
Dim deIIS As New DirectoryEntry("IIS://localhost/W3SVC")
deIIS = New DirectoryEntry("IIS://localhost/W3SVC")
For Each site As DirectoryEntry In deIIS.Children
If site.SchemaClassName = "IIsWebServer" Then
MsgBox(site.Name)
MsgBox(site.Properties("ServerComment").Value.ToString)
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try


I’ve created my setup as an .exe requiring Admin rights because I saw that this stuff may need that requirement.
Answered 08/09/2011 by: Superfreak3
Black Belt

Please log in to comment
0
ORIGINAL: Superfreak3

One more thing I noticed, session.log statements are not reflected when I generate a log from the command line.
Where should I be seeing these log status messages?


It should, where/how is the CA executed?
Answered 08/10/2011 by: AngelD
Red Belt

Please log in to comment
0
I haven't used VB.NET but should it not be
Dim deIIS As New DirectoryEntry
deIIS = New DirectoryEntry("IIS://localhost/W3SVC")
Answered 08/10/2011 by: AngelD
Red Belt

Please log in to comment
0
Thanks AngelD.

The CA is currently executed from the Next button of the Welcome dialog just for testing. I don't know if this will be the final resting place for it or not. It is synchronous/immediate.
Answered 08/11/2011 by: Superfreak3
Black Belt

Please log in to comment
0
I haven't used VB.NET but should it not be
Dim deIIS As New DirectoryEntry
deIIS = New DirectoryEntry("IIS://localhost/W3SVC")


Both syntax scenarios produce the same result I believe.
Answered 08/11/2011 by: Superfreak3
Black Belt

Please log in to comment
0
ORIGINAL: Superfreak3

Thanks AngelD.

The CA is currently executed from the Next button of the Welcome dialog just for testing. I don't know if this will be the final resting place for it or not. It is synchronous/immediate.


Matt,
I've read that others has problem with the session.log method while executing the CA with DoAction which is used during Dialog "clicking" ;)
So see if you can use the C++ code instead or a wrapper for C++ API calls; http://stackoverflow.com/questions/1682462/wix-customaction-session-log-not-working
Answered 08/11/2011 by: AngelD
Red Belt

Please log in to comment
0
I've got all the code working, finally!! My custom action now handles the grabbing of sites for the ListBox control for IIS 6 & 7. One little thing I did notice deals with the situation where only one web site is found. If this is the case, I set the property associated with the ListBox to the name of the lone site. When I do this traversing the IIS 7 code, the lone website does appear in the ListBox and is highlighted. However, when I test on IIS 6, the name is not highlighted in the ListBox. I do however know that the property has been set properly becasue I am able to get to the next dialog. I conditionally check that a site was selected. This however is a small issue that I can live with I guess. I just wonder why in one instance the individual site is highlighted and not in the other case.

I will check the logging stuff by first maybe setting it to run outside of a dialog. If that doesn't work I'll hit your C++ links.

Oh and I did want to mention that your VB syntax suggestion solved my problem of the Unknown Exception. While it worked either way from a standalone .exe, it had to be written the way you suggested for it to function properly in the confines of the Custom Action. Beats me, but I'll take it! Thanks much for that!!!

After logging, I'll just use install my files with InstallShield and do all the IIS configuration and other config file edits through Deferred CA's.

Thanks for the help so far!!!
Answered 08/11/2011 by: Superfreak3
Black Belt

Please log in to comment
0
Moving the actions off the dialog button (away from DoAction) and into sequence (after LaunchConditions) seems to allow logging to function properly.

I'll have to keep your suggestion in mind in case we run into a situation where something is needed from a button click.
Answered 08/11/2011 by: Superfreak3
Black Belt

Please log in to comment
0
when you do all the vd / website creates use the WiX IIS modules it is so much easier than writing all your own code.

If your not familiar with wix you can export from a wix generated package the table / CA's etc.
Answered 08/11/2011 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
If you're going to use the WiX IIS module then the below would help you to setup the WiX file

http://ranjithk.com/2009/12/17/automating-web-deployment-using-windows-installer-xml-wix/
Answered 08/12/2011 by: AngelD
Red Belt

Please log in to comment
0
You may also wanna check out WiX tricks and tips
Answered 08/12/2011 by: AngelD
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity