Sorry, I didn't catch your post earlier.
The easiest way to fixed undesired ID allocation is to use explicit IDs. Though in your case it is problematic as
Also you may find IIS_XMLInjection sample very useful as it shows some raw XML manipulation techniques.
Unfortunately my knowledge of IIS is rather limited. Thus it's hard for me to judge but if you feel that your use case is reasonable common, log a feature request and I will expose WebApplication.Id directly to the Wix# interface.
The easiest way to fixed undesired ID allocation is to use explicit IDs. Though in your case it is problematic as
WebApplication
element mapped indirectly. Thus the only choice you have is to replace the attribute directly (after the allocation). Have a look at InjectXML sample. It will be something like this:project.WixSourceGenerated += doc => doc.Root.FindAll("WebApplication") .First() .SetAttribute("Id", "NewIdValue");
Unfortunately my knowledge of IIS is rather limited. Thus it's hard for me to judge but if you feel that your use case is reasonable common, log a feature request and I will expose WebApplication.Id directly to the Wix# interface.