Skip to content

Instantly share code, notes, and snippets.

@smarenich
Last active November 25, 2016 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/a63e13506898a330c254526cf2091bcf to your computer and use it in GitHub Desktop.
Save smarenich/a63e13506898a330c254526cf2091bcf to your computer and use it in GitHub Desktop.
using System;
using PX.Data;
using System.Collections.Specialized;
using Customization;
using System.Web.Security;
using System.IO;
using PX.Common;
namespace ChangeWebConfig
{
//Customization plugin is used to execute custom actions after customization project was published
public class MyPlugIn: CustomizationPlugin
{
//This method executed right after website files were updated, but before website was restarted
//Method invoked on each cluster node in cluster environment
//Method invoked only if runtimecompilation is enabled
//Do not access custom code published to bin folder, it may not be loaded yet
public override void OnPublished()
{
this.WriteLog("OnPublished Event");
String file = File.ReadAllText(Path.Combine(PX.Data.Update.PXInstanceHelper.RootFolder, "packages.config"));
file = webconfig.Replace("</packages>",
"<package id=/"Newtonsoft.Json/" version=/"6.0.8/" targetFramework=/"net451/" /></packages>");
File.WriteAllText(Path.Combine(PX.Data.Update.PXInstanceHelper.RootFolder, "packages.config"), file);
}
//This method executed after customization was published and website was restarted.
public override void UpdateDatabase()
{
this.WriteLog("UpdateDatabase Event");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment