Skip to content

Instantly share code, notes, and snippets.

@sitereactor
Created April 8, 2013 14:51
Show Gist options
  • Save sitereactor/5337369 to your computer and use it in GitHub Desktop.
Save sitereactor/5337369 to your computer and use it in GitHub Desktop.
Updates the DefaultRenderingEngine in the umbracoSettings.config file
public class UpdateRenderingEngineToMvc()
{
//Local variables
var path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar;
var filePath = path + "umbracoSettings.config";
var value = RenderingEngine.Mvc;
//Load the config file as xml
var xml = new XmlDocument();
var settingsReader = new XmlTextReader(filePath);
xml.Load(settingsReader);
//Find the correct node for the 'defaultRenderingEngine' and update the value
var node = xml.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine");
node.InnerText = value.ToString();
xml.Save(filePath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment