I need to create a package that among other things will have to modify the web.config. The modifications needed are:
Create a custom section group under "configSections" and append items to it.
Add assemblies to the "assemblies" section.
Add handlers to section "system.WebServer/handlers"
Add a new cutom section under the root "configuration"
The only information I was able to find on this subject is this article, which covers a lot of possible package actions but looks like none will work for the above requirements.
So, are there more actions then the ones listed or do I have to make this changes through code? If C# is the solution, how and where I will call my functions to apply/undo the changes?
I have added nodes to the config files using c# code for packages I have released.
I can dig out what I did and copy in here - I would expect the experts to be able to improve upon it, but at least it will be a starting point for you.
The code is at home, so will dig out over the next couple of days.
I've started the Package action contrib for that reason. You can either include the dll, or use the code. If you use the source code make sure to have unique aliasses for every action.
I would investigate Richard's solution but from a code "hacker" from down under here is what I did
string filePath = System.Web.HttpContext.Current.Server.MapPath("~/umbraco/config/lang/en.xml"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filePath); //Test to make sure the node does not already exist var testForNode = xmlDoc.SelectNodes("/language/area[@alias = 'sections']/key[@alias = 'tagMaint']"); if (testForNode.Count == 0) { //Create a new XML <key> node XmlElement keyNode = xmlDoc.CreateElement("key"); keyNode.SetAttribute("alias", "tagMaint"); keyNode.InnerText = "Tag Maintenance"; //Add <key> to file and save. xmlDoc.SelectSingleNode("/language/area[@alias='sections']").AppendChild(keyNode); xmlDoc.Save(filePath); }
New Package, web.config and package actions.
I need to create a package that among other things will have to modify the web.config.
The modifications needed are:
If C# is the solution, how and where I will call my functions to apply/undo the changes?
Hi Codemaster
I have added nodes to the config files using c# code for packages I have released.
I can dig out what I did and copy in here - I would expect the experts to be able to improve upon it, but at least it will be a starting point for you.
The code is at home, so will dig out over the next couple of days.
Cheers, Nigel
That would be very helpful, thanks a lot.
Hi,
I've started the Package action contrib for that reason. You can either include the dll, or use the code. If you use the source code make sure to have unique aliasses for every action.
Cheers,
Richard
I would investigate Richard's solution but from a code "hacker" from down under here is what I did
Hope this provides some ideas.
Cheers, Nigel
is working on a reply...