diff --git a/build/Build-Debug.ps1 b/build/Build-Debug.ps1 index 737879740..bdbc0df92 100644 --- a/build/Build-Debug.ps1 +++ b/build/Build-Debug.ps1 @@ -53,7 +53,9 @@ if ($LocalPnPFramework) { $pnpFrameworkAssembly = Join-Path $PSScriptRoot -ChildPath "..\..\pnpframework\src\lib\PnP.Framework\bin\Debug\netstandard2.0\PnP.Framework.dll" $pnpFrameworkAssembly = [System.IO.Path]::GetFullPath($pnpFrameworkAssembly) if (Test-Path $pnpFrameworkAssembly -PathType Leaf) { - $buildCmd += " -p:PnPFrameworkPath=`"..\..\..\pnpframework\src\lib\`"" + $pnpFrameworkPath = $pnpFrameworkAssembly.Substring(0, $pnpFrameworkAssembly.IndexOf("PnP.Framework")) + Write-Host -Message "PnPFrameworkPath: $pnpFrameworkPath" + $buildCmd += " -p:PnPFrameworkPath=`"$pnpFrameworkPath`"" } else { $localFolder = Join-Path $PSScriptRoot -ChildPath "..\..\pnpframework" @@ -66,7 +68,9 @@ if ($LocalPnPCore) { $pnpCoreAssembly = Join-Path $PSScriptRoot -ChildPath "..\..\pnpcore\src\sdk\PnP.Core\bin\Debug\netstandard2.0\PnP.Core.dll" $pnpCoreAssembly = [System.IO.Path]::GetFullPath($pnpCoreAssembly) if (Test-Path $pnpCoreAssembly -PathType Leaf) { - $buildCmd += " -p:PnPCoreSdkPath=`"..\..\..\pnpcore\src\sdk\`"" + $pnpCoreSdkPath = $pnpCoreAssembly.Substring(0, $pnpCoreAssembly.IndexOf("PnP.Core")) + Write-Host -Message "PnPCoreSdkPath: $pnpCoreSdkPath" + $buildCmd += " -p:PnPCoreSdkPath=`"$pnpCoreSdkPath`"" } else { $localFolder = Join-Path $PSScriptRoot -ChildPath "..\..\pnpcore" diff --git a/src/Commands/Base/SetTraceLog.cs b/src/Commands/Base/SetTraceLog.cs index d10c0706b..d252b7d2d 100644 --- a/src/Commands/Base/SetTraceLog.cs +++ b/src/Commands/Base/SetTraceLog.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; using System.Management.Automation; +using System.IO; namespace PnP.PowerShell.Commands.Base { @@ -58,11 +59,19 @@ protected override void ProcessRecord() { LogFile = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, LogFile); } + Console.WriteLine("LogFile path is : " + LogFile); // Create DelimitedListTraceListener in case Delimiter parameter has been specified, if not create TextWritterTraceListener +#if !NETFRAMEWORK + var fileStreamOptions = new FileStreamOptions { Mode = FileMode.Append, BufferSize = AutoFlush ? 0 : 4096, Access = FileAccess.Write, Options = AutoFlush ? FileOptions.WriteThrough : FileOptions.None }; + var fileStream = File.Open(LogFile, fileStreamOptions); + TraceListener listener = !string.IsNullOrEmpty(Delimiter) ? + new DelimitedListTraceListener(fileStream) { Delimiter = Delimiter, TraceOutputOptions = TraceOptions.DateTime } : + new TextWriterTraceListener(fileStream); +#else TraceListener listener = !string.IsNullOrEmpty(Delimiter) ? new DelimitedListTraceListener(LogFile) { Delimiter = Delimiter, TraceOutputOptions = TraceOptions.DateTime } : new TextWriterTraceListener(LogFile); - +#endif listener.Name = FileListenername; Trace.Listeners.Add(listener); PnP.Framework.Diagnostics.Log.LogLevel = Level; diff --git a/src/Commands/PnP.PowerShell.csproj b/src/Commands/PnP.PowerShell.csproj index b7b2e4d40..066df5825 100644 --- a/src/Commands/PnP.PowerShell.csproj +++ b/src/Commands/PnP.PowerShell.csproj @@ -68,14 +68,11 @@ - + + - - - - + + diff --git a/src/Commands/Provisioning/Site/GetSiteTemplate.cs b/src/Commands/Provisioning/Site/GetSiteTemplate.cs index 573d73a3f..a7110b8aa 100644 --- a/src/Commands/Provisioning/Site/GetSiteTemplate.cs +++ b/src/Commands/Provisioning/Site/GetSiteTemplate.cs @@ -120,6 +120,12 @@ public class GetSiteTemplate : PnPWebCmdlet [Parameter(Mandatory = false)] public ExtractConfigurationPipeBind Configuration; + [Parameter(Mandatory = false)] + public SwitchParameter UseFileStreams; + + [Parameter(Mandatory = false, Position = 0)] + public string PnPTempFilesPath; + protected override void ExecuteCmdlet() { ExtractConfiguration extractConfiguration = null; @@ -201,7 +207,7 @@ private void ExtractTemplate(XMLPnPSchemaVersion schema, string path, string pac var fileSystemConnector = new FileSystemConnector(path, ""); if (extension == ".pnp") { - creationInformation.FileConnector = new OpenXMLConnector(packageName, fileSystemConnector); + creationInformation.FileConnector = new OpenXMLConnector(packageName, fileSystemConnector, null, null, null, UseFileStreams, PnPTempFilesPath); } else if (extension == ".md") {