/// <summary> /// Processed before the Execute /// </summary> protected override void BeginProcessing() { base.BeginProcessing(); if (SPIaCConnection.CurrentConnection == null) { throw new InvalidOperationException(Resources.NoConnection); } if (ClientContext == null) { throw new InvalidOperationException(Resources.NoConnection); } Uri uri = new Uri(this.ClientContext.Url); var urlParts = uri.Authority.Split(new[] { '.' }); BaseUri = string.Format("https://{0}.{1}.{2}", urlParts[0], urlParts[1], urlParts[2]); var runningDirectory = this.SessionState.Path.CurrentFileSystemLocation; var runningAssembly = Assembly.GetExecutingAssembly(); var runningAssemblyName = runningAssembly.ManifestModule.Name; var appConfig = string.Format("{0}\\{1}.config", runningDirectory, runningAssemblyName).Replace("\\", @"\"); if (System.IO.File.Exists(appConfig)) { LogVerbose("AppSettings file found at {0}", appConfig); logger = new ConfigurationLogger(appConfig, true, CmdLetName); loggerAvailable = true; } OnBeginInitialize(); LogVerbose(">>> Begin {0} at {1} on URL:[{2}]", this.CmdLetName, DateTime.Now, this.ClientContext.Url); }
protected override void BeginProcessing() { base.BeginProcessing(); var runningDirectory = this.SessionState.Path.CurrentFileSystemLocation; var runningAssembly = Assembly.GetExecutingAssembly(); var runningAssemblyName = runningAssembly.ManifestModule.Name; var appConfig = string.Format("{0}\\{1}.config", runningDirectory, runningAssemblyName).Replace("\\", @"\"); if (System.IO.File.Exists(appConfig)) { LogVerbose("AppSettings file found at {0}", appConfig); Logger = new ConfigurationLogger(appConfig, true, CmdLetName); IsLoggerAvailable = true; } OnBeginInitialize(); LogVerbose(">>> Begin {0} at {1}", this.CmdLetName, DateTime.UtcNow); }