Click here to Skip to main content
12,241,814 members (38,749 online)
Click here to Skip to main content
Add your own
alternative version

Stats

6.3K views
90 downloads
1 bookmarked
Posted

WIX: XmlConfig Fails in Modifying ApplicationHost.config

, 2 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
To resolve a WIX issue: XmlConfig fails in modifying ApplicationHost.Config because site is not created yet.

Issue Description

Recently we used XmlConfig to modify our web site tag in ApplicationHost.config to add AdvancedLogging settings. But we failed with an installation error saying the required XML node did not exist. Our WIX version is v3.7.  

Analysis 

After some time of investigation, we found the root cause. WIX uses a deferred CA (Custom Action) - ConfigureIIs to create and configure web site related items on IIS. And it uses another CA - SchedXmlConfig to work for XmlConfig. SchedXmlConfig is a immediate CA. It schedules another two deferred CA - ExecXmlConfig and ExecXmlConfigRollback to do the real work for XmlConfig. However, SchedXmlConfig is before ConfigureIIs in InstallExecuteSequence and it always schedules ExecXmlConfig and ExecXmlConfigRollback to be before ConfigureIIs too. Therefore, WIX tried to modify ApplicationHost.config before our web site is created. Certainly it could not find our site node.

Solution   

We noticed that SchedXmlConfig always schedules ExecXmlConfig and ExecXmlConfigRollback after itself. So the solution is to make SchedXmlConfig execute after ConfigureIIs.  

We could use Orca.exe to directly modify MSI directly. But a better solution is to use the <Custom> tag as the below:

<InstallExecuteSequence>
  <Custom Action="SchedXmlConfig" After="ConfigureIIs"/>
</InstallExecuteSequence>  

In fact, this method can be used to reschedule any WIX predefined CA.  

Sample Code

The sample code contains a WIX setup project to deploy a simple web site on IIS and modify ApplicationHost.config to set the log file rollover option to Weekly.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Zhuyun Dai
Architect
China China
Over 10-years experience in using Microsoft technologies.
At present, working as the architect of a clustered real-time data delivery and visualization system, responsible for the design of component architecture, product packaging and deployment, also targeting private cloud solutions for future.

You may also be interested in...

Comments and Discussions

 
QuestionThis solves other problems too Pin
Grant Shirreffs5-Oct-14 12:15
memberGrant Shirreffs5-Oct-14 12:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160426.1 | Last Updated 2 Aug 2013
Article Copyright 2013 by Zhuyun Dai
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid