The Problem is Here:

{
             Site site = iisManager.Sites[webSite];
             basePath = site.Applications["/"].
                                 VirtualDirectories["/"].PhysicalPath;
         }

         session.Log("SetInstallDir: Physical path : {0}", basePath);

          // Environment variables are used in IIS7 so expand them.
         basePath = Environment.ExpandEnvironmentVariables(basePath);

         // Get the web application name and poke that onto the end.
         String webAppName = session["WEB_APP_NAME"];
         String finalPath = Path.Combine(basePath, webAppName);

         // Set INSTALLDIR to the calculate path.
         session.Log("SetInstallDir: Setting INSTALLDIR to {0}",
                     finalPath);
         session["INSTALLDIR"] = finalPath;
     }

The BasePath and the Final Path are only Correct when the Default  
Application Virtual Directory is used, because your grabbing the 1st  
item in the collection...  You must treat the list of sites as a  
Collection, therefore before assigning the final path you must iterate  
the collection, and return the one the user selected.

See this Post at StackOverflow for some pointers...

http://stackoverflow.com/questions/19415624/get-iis-default-installation-directory




------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to