ricobautsch
Pilgrim

Changing IISROOTFOLDER

I have trouble while installing components for IIS.

I have build a dialog, where user can select the IIS WebSite.
Then in InstallScript, after the dialogs i call:

MsiSetProperty(ISMSI_HANDLE, "IISROOTFOLDER", WebSitePath);

The result is, that some components install in the correct selected WebSite path, and others will be installed in the default wwwroot.

Components that should install to the root of my web app are installed by mistake under c:\inetpub\wwwroot\my.web.
Components that should install in subdirectories of my web app are installed correctly under c:\inetpub\wwwroot_site2\my.web\App_Data.

Do you have any clue why this happens?
Why is changing the IISROOTFOLDER with MsiSetProperty not handled correctly anywhere?
Labels (1)
0 Kudos
3 Replies
rguggisberg
Frequent contributor

Re: Changing IISROOTFOLDER

Put a MessageBox or Sprintf statement in your InstallScript code to see what the value of WebSitePath is. You may find that it is blank. How is your CA executed? You need to do a little work to make properties available to a deferred CA. Where is your Custom Action sequenced? It may be too late. Basic MSI or InstallScript MSI project?
0 Kudos
ricobautsch
Pilgrim

Re: Changing IISROOTFOLDER

With a MessageBox i can see, my WebSitePath is set correctly to the directory i want.

I have a InstallScript MSI Project, and i do MsiSetProperty(ISMSI_HANDLE, "IISROOTFOLDER", WebSitePath) in the OnFirstUIBefore() method, just after the last dialog was called.
I have got a workaround by calling MsiSetProperty for all my directory variables, which depend directly or indirectly from IISROOTFOLDER.

It seems to me, that directory variables are resolved at different times, and i don't understand where and when.

If you mean CustomAction with CA, then no, i have no custom action, i'm in the OnFirstUIBefore().
Currently i have no experiences with CustomActions, i'm doing all my stuff in the scripts and the scripted events of features.

What would be the way to tell the installer the value of a variable, if i would use a CA?
0 Kudos
rguggisberg
Frequent contributor

Re: Changing IISROOTFOLDER

Variable names that you want to be public must be in ALL UPPERCASE.
Setting variable in CA would be same as you are doing now (InstallScript code) or if that is all you need to do you could use a 'Set Property' CA. That would be found under 'Behavior and Logic', 'Custom Action'. Right click on 'Custom Actions' and select 'New Set Property'.
0 Kudos