namespace UpdateManifest { [RunInstaller(true)] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] public partial class Installer1 : Installer { public Installer1() { InitializeComponent(); } // Override Install to update the customization location // in the application manifest. public override void Install(System.Collections.IDictionary stateSaver) { // Call the base implementation. base.Install(stateSaver); UpdateApplicationManifest(); } private void UpdateApplicationManifest() { // Define the parameters passed to the task. string targetDir = this.Context.Parameters["targetDir"]; string documentName = this.Context.Parameters["documentName"]; string assemblyName = this.Context.Parameters["assemblyName"]; if (String.IsNullOrEmpty(targetDir)) throw new InstallException("Cannot update the application manifest. The specified target directory name is not valid."); if (String.IsNullOrEmpty(documentName)) throw new InstallException("Cannot update the application manifest. The specified document name is not valid."); if (String.IsNullOrEmpty(assemblyName)) throw new InstallException("Cannot update the application manifest. The specified assembly name is not valid."); // Get the application manifest from the document. string documentPath = Path.Combine(targetDir, documentName); ServerDocument serverDocument = new ServerDocument(documentPath, FileAccess.ReadWrite); try { AppManifest appManifest = serverDocument.AppManifest; //bool allUsers = String.Equals(documentPath, "1"); string assemblyPath = Path.Combine(targetDir, assemblyName); appManifest.Dependency.AssemblyPath = assemblyPath; serverDocument.Save(); } finally { if (serverDocument != null) { serverDocument.Close(); } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)