Conditional XML settings - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

Conditional XML settings

Hi,

We have an issue where we need to change certain settings in the web.config of an IIS web site, dependant on if the IIS is v6 or v7 and above

i.e. in v6 we need

Code: Select all

  <system.web>
      <httpHandlers>
          <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
but in v7/v7.5/v8 we need

Code: Select all

 <system.webServer>
     <handlers>
         <add name="*.ashx" path="*.ashx" verb="*" type="AjaxPro.AjaxHandlerFactory, AjaxPro" resourceType="Unspecified" requireAccess="Script" />
what s the best way to go about doing this, as I cant find an easy way to do xml edit conditionally on a setting.

Also how do I know what IIS version is installed on a machine ? (I already limit the installer to v6 or above in Launch Conditions)
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Conditional XML settings

Hi,

In order to achieve this you ca follow the steps below:
- go in the Search page and use the [Extended Search] toolbar button to create a new "File Version" search and rename it (i.e. IIS_VERSION)
- in the "File to Find" text field write the following path: [SystemFolder]inetsrv\w3wp.exe (this contains the IIS version on the user's machine)
- go in the Files and Folders page and create two XML edit files (one for IIS6 and one for IIS7 and above) and use the method described in the How do I install two files with the same name in the same folder article
- go in the Organization page and move these files in two different components (an XML edit file cannot be placed alone in a component, so you can create two "dummy" registry entries and place the XML files in components along with those registry)
- use the "IIS_VERSION" property to set conditions for your components (i.e. IIS_VERSION<7 for IIS v6 and IIS_VERSION>=7 for IIS v7 and above)
- build and run the project

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

Re: Conditional XML settings

Thanks, That was perfect
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Conditional XML settings

You're welcome. I'm glad you got this working.

Best Regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”