Last active
November 25, 2016 05:36
-
-
Save smarenich/a63e13506898a330c254526cf2091bcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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