I've seen at least 3 projects that attempt to eliminate the otherwise cumbersome hassle of editing the web.config file, which needs to be modified in order to allow the use of Ajax. While I appreciate the effort others have taken with these projects, it was also a bit frustrating because none of them were flawless. Amongst the SharePoint Features project on Codeplex is the 3.5.Config for instance, which does work when you install it, but when you deinstall it later
it deletes the entire "<pages /> section and also seemed to "confuse" the Web Services of my SharePoint installation, causing all further install attempts to modify the web.config file to fail.
To be fair though, the Microsoft documentation on this topic is quite sparse (to say it politely), so it's not that easy to get to the bottom of these problems.
Well, I just happened to be in need for such a solution again and as it is simply too much hassle to modify the web.config manually (especially when you have to modify it on multiple Web Frontends), I just took the time once more to see if anyone had come up with some inspiration...
As luck had it, I found some good stuff in the SharePoint guidance project on Codeplex. This project has quite some depth to it, so I decided to "extract some good approaches" that addressed what I needed for my project (hey, I think Picasso once said that creativity is nothing more than clever copying from different sources ;-)
I've tested my solution on a couple of installs so far, and it seems to work fine. I'll keep testing it some more, but also thought that someone else might want to use it right away. So,
here's the download link to the .wsp file for this solution. Feel free to use it AT YOUR OWN RISK and let me know if you have problems, or whether it worked for you.
P.S. Kudos to everyone involved in the SharePoint Guidance project!
Update (23-AUG-09): Thanks to Ernst Joss I've found and fixed a problem with this solution: whenever the <controls> section already existed, the tagprefix line was not added. And afterwards, when deactivating the feature, the whole <controls> section, potentially including other content, was deleted.
I've split the respective web.config modification now into two parts: one EnsureSection entry for the <controls> section, and a separate EnsureChildNode entry for adding the tagprefix line.
The download link above has the updated 1.0.1 version of the wsp.