From 6af1903d8c461a02cd94d461a756164d0a3bc888 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 15:55:02 -0700 Subject: [PATCH 01/14] Fixed #58: Multi-line commands rendering wrong --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index e0e27cd..07eb4bd 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using OutGridView.Models; using Terminal.Gui; @@ -164,6 +165,11 @@ private static string GetPaddedString(List strings, int[] colWidths, int builder.Append(' '); } + // Replace any newlines with encoded newline (`n) + // Note we can't use Environment.Newline because we don't know that the + // Command honors that. + strings[i] = strings[i].Replace("\n", "`n"); + // If the string won't fit in the column, append an ellipsis. if (strings[i].Length > colWidths[i]) { From a69373eae9534aaf1a771f372982b5ea03ecc6de Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:00:25 -0700 Subject: [PATCH 02/14] Fixed #58 - Newlines in commands render incorrectly --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 07eb4bd..19deced 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Text.RegularExpressions; using OutGridView.Models; using Terminal.Gui; From f155262ca88adaab5c49c16fd232b789d6c32abe Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:30:01 -0700 Subject: [PATCH 03/14] Added debug instructions to readme --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 073a375..5672e70 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,35 @@ Get-Process | Out-ConsoleGridView > NOTE: If you change the code and rebuild the project, you'll need to launch a > _new_ PowerShell process since the dll is already loaded and can't be unloaded. +### Debugging in Visual Studio Code + + +```powershell +PS C:\path\to\GraphicalTools> code . +``` + +Build by hitting `Ctrl-Shift-b` in VS Code. + +To debug: + +In a Powershell session in the `c:\path\to\GraphicalTools` directory, run `pwsh` (thus nesting powershell). + +Then do the folowing: + +```powershell +Import-Module .\module\Microsoft.PowerShell.ConsoleGuiTools +$pid +``` + +This will import the latest built DLL and output the process ID you'll need for debugging. Copy this ID to the clipboard. + +In VScode, set your breakpoints, etc... Then hit `F5`. In the VScode search box, paste the value printed by `$pid`. You'll see something like `pwsh.exe 18328`. Click that and the debug session will start. + +In the Powershell session run your commands; breakpoints will be hit, etc... + +When done, run `exit` to exit the nested PowerShell and run `pwsh` again. This unloads the DLL. Repeat. + + ## Contributions Welcome! We would love to incorporate community contributions into this project. If you would like to From 440833ea33563e47efbb1c2558be67fd125291ef Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 16:31:28 -0700 Subject: [PATCH 04/14] Update src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Co-Authored-By: Tyler James Leonhardt --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 19deced..e784836 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -167,6 +167,7 @@ private static string GetPaddedString(List strings, int[] colWidths, int // Replace any newlines with encoded newline (`n) // Note we can't use Environment.Newline because we don't know that the // Command honors that. + strings[i] = strings[i].Replace("\r\n", "`r`n"); strings[i] = strings[i].Replace("\n", "`n"); // If the string won't fit in the column, append an ellipsis. From dd2e765f705d9914aee7ad1b4e6cde2eeafcc432 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 11 Mar 2020 19:45:23 -0700 Subject: [PATCH 05/14] simplified stripping of newline/linefeed --- src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index e784836..2692d5b 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -164,10 +164,10 @@ private static string GetPaddedString(List strings, int[] colWidths, int builder.Append(' '); } - // Replace any newlines with encoded newline (`n) + // Replace any newlines with encoded newline/linefeed (`n or `r) // Note we can't use Environment.Newline because we don't know that the // Command honors that. - strings[i] = strings[i].Replace("\r\n", "`r`n"); + strings[i] = strings[i].Replace("\r", "`r"); strings[i] = strings[i].Replace("\n", "`n"); // If the string won't fit in the column, append an ellipsis. From a54d7d31848985507ec406fd80eb72cd2edad2b4 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Fri, 3 Jun 2022 15:06:29 +1200 Subject: [PATCH 06/14] Updated references to latest Terminal.Gui --- README.md | 4 +++- global.json | 2 +- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d762d96..4c9770f 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,10 @@ Now you're ready to build the code. You can do so in one of two ways: PS ./GraphicalTools> Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools ``` -From there you can import the module that you just built for example: +From there you can import the module that you just built for example (start a fresh `pwsh` instance first so you can unload the module with an `exit`; otherwise building again may fail because the `.dll` will be held open): ```powershell +pwsh Import-Module ./module/Microsoft.PowerShell.ConsoleGuiTools ``` @@ -59,6 +60,7 @@ And then run the cmdlet you want to test, for example: ```powershell Get-Process | Out-ConsoleGridView +exit ``` > NOTE: If you change the code and rebuild the project, you'll need to launch a diff --git a/global.json b/global.json index 1e85f0e..b8cfb5c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.102" + "version": "3.1.*" } } diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index c957b30..48dfbd1 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -5,8 +5,8 @@ - - + + From 7134c167ddac3688435db71917505c60def76a12 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Fri, 3 Jun 2022 22:47:57 +1200 Subject: [PATCH 07/14] Fixed #131 and upgraded to terminal.gui 1.6, pwsh 7.2, and net60 --- .vscode/launch.json | 4 ++-- .vscode/tasks.json | 2 +- Build.ps1 | 2 +- GraphicalTools.build.ps1 | 2 +- global.json | 2 +- .../Microsoft.PowerShell.ConsoleGuiTools.csproj | 5 +++-- .../Microsoft.PowerShell.ConsoleGuiTools.psd1 | 11 +++++++++-- .../TypeGetter.cs | 5 ++++- .../Microsoft.PowerShell.GraphicalTools.csproj | 4 ++-- .../Microsoft.PowerShell.OutGridView.Models.csproj | 2 +- src/OutGridView.Gui/OutGridView.Gui.csproj | 2 +- 11 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d7be52a..b079d9a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Cmdlet/bin/Debug/netcoreapp3.0/win10-x64/OutGridViewCmdlet.dll", + "program": "${workspaceFolder}/Cmdlet/bin/Debug/net60/win10-x64/OutGridViewCmdlet.dll", "args": [], "cwd": "${workspaceFolder}/Cmdlet", "console": "internalConsole", @@ -20,7 +20,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Application/bin/Debug/netcoreapp3.0/win10-x64/OutGridViewApplication.dll", + "program": "${workspaceFolder}/Application/bin/Debug/net60/win10-x64/OutGridViewApplication.dll", "args": [], "cwd": "${workspaceFolder}/Application", "console": "internalConsole", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0056896..48c411a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,7 @@ "command": "/usr/local/bin/pwsh" }, "windows": { - "command": "pwsh.exe" + "command": "C:/Program Files/PowerShell/7-preview/pwsh.exe" }, "linux": { "command": "/usr/local/bin/pwsh" diff --git a/Build.ps1 b/Build.ps1 index fd2eeff..a2f7bbb 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -8,4 +8,4 @@ Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools # Run what was built... # pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.GraphicalTools'; Get-Module -all | Out-GridView -OutputMode Single -Title 'Imported Modules' -pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules' -Filter power" \ No newline at end of file +pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules'" \ No newline at end of file diff --git a/GraphicalTools.build.ps1 b/GraphicalTools.build.ps1 index dbbeef9..38a2255 100644 --- a/GraphicalTools.build.ps1 +++ b/GraphicalTools.build.ps1 @@ -10,7 +10,7 @@ param( $script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows -$script:TargetFramework = "netcoreapp3.0" +$script:TargetFramework = "net60" $script:RequiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version $script:ModuleLayouts = @{} diff --git a/global.json b/global.json index b8cfb5c..e96609f 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.*" + "version": "6.0.300" } } diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj index 48dfbd1..329c2d9 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj @@ -1,13 +1,14 @@ - netcoreapp3.0 + net60 - + + diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 index 4f65515..27e839f 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 @@ -9,7 +9,7 @@ RootModule = 'Microsoft.PowerShell.ConsoleGuiTools.dll' # Version number of this module. -ModuleVersion = '0.6.3' +ModuleVersion = '0.7.2' # Supported PSEditions CompatiblePSEditions = @( 'Core' ) @@ -30,7 +30,7 @@ Copyright = '(c) Microsoft Corporation.' Description = 'Cross-platform Console Gui Tools for PowerShell' # Minimum version of the PowerShell engine required by this module -PowerShellVersion = '6.2' +PowerShellVersion = '7.2' # Name of the PowerShell host required by this module # PowerShellHostName = '' @@ -105,6 +105,13 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = '# Release Notes +## v0.7.0 + +Upugraded to PS 7.2 and net60 + +Updated Terminal.Gui to 1.6 + +Fixed #131 - Strip ANSI ## v0.6.3 diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs index c9bbbff..9b1a5a9 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs @@ -1,13 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; +using System; using System.Management.Automation; using System.Linq; using System.Globalization; using System.Collections.Generic; using Microsoft.PowerShell.Commands; using OutGridView.Models; +using System.Text.RegularExpressions; namespace OutGridView.Cmdlet { @@ -62,6 +63,8 @@ public DataTableRow CastObjectToDataTableRow(PSObject ps, List } else { + // Strip ANSI + stringValue = new Regex(@"\x1B\[[^@-~]*[@-~]").Replace(stringValue, ""); valuePairs[dataColumn.ToString()] = new StringValue { DisplayValue = stringValue }; } } diff --git a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj index 45b17d0..641b030 100644 --- a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj +++ b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj @@ -1,11 +1,11 @@ - netcoreapp3.0 + net60 - + diff --git a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj index 4c6378b..1de4046 100644 --- a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj +++ b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj @@ -1,7 +1,7 @@ - netcoreapp3.0 + net60 diff --git a/src/OutGridView.Gui/OutGridView.Gui.csproj b/src/OutGridView.Gui/OutGridView.Gui.csproj index e8e8818..e195417 100644 --- a/src/OutGridView.Gui/OutGridView.Gui.csproj +++ b/src/OutGridView.Gui/OutGridView.Gui.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + net60 From 8daadd32bb17d37dc1e7d2c6e1427037a3159ae0 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Fri, 3 Jun 2022 23:20:22 +1200 Subject: [PATCH 08/14] supported .net and reverted change --- global.json | 2 +- src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/global.json b/global.json index e96609f..3cf3f81 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.300" + "version": "6.0.203" } } diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs index 9b1a5a9..35e5ab9 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs @@ -63,8 +63,6 @@ public DataTableRow CastObjectToDataTableRow(PSObject ps, List } else { - // Strip ANSI - stringValue = new Regex(@"\x1B\[[^@-~]*[@-~]").Replace(stringValue, ""); valuePairs[dataColumn.ToString()] = new StringValue { DisplayValue = stringValue }; } } From 02f69a1abfeea9284a12b4a0120ae083a0475720 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Fri, 3 Jun 2022 23:30:09 +1200 Subject: [PATCH 09/14] revert using that was accidentally added --- src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs index 35e5ab9..d93c449 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using Microsoft.PowerShell.Commands; using OutGridView.Models; -using System.Text.RegularExpressions; namespace OutGridView.Cmdlet { From 855e1a1fb5e7075fbfef0f2416eebeda885ccd52 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Sat, 4 Jun 2022 00:56:31 +1200 Subject: [PATCH 10/14] Fixes regressing caused by Terminal.Gui 1.6 re: Filter Error label --- Build.ps1 | 2 +- .../ConsoleGui.cs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index a2f7bbb..c43e139 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -8,4 +8,4 @@ Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools # Run what was built... # pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.GraphicalTools'; Get-Module -all | Out-GridView -OutputMode Single -Title 'Imported Modules' -pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules'" \ No newline at end of file +# pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules'" diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 2ad6f0d..10ba3d4 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -205,23 +205,23 @@ private void AddFilter(Window win) Width = Dim.Fill() - _filterLabel.Text.Length }; - var filterErrorLabel = new Label(string.Empty) + // Note: See Issue #1769 in Terminal.Gui for why the constructor to Label can't take string.Empty + var filterErrorLabel = new Label(" ") { X = Pos.Right(_filterLabel) + 1, Y = Pos.Top(_filterLabel) + 1, - ColorScheme = Colors.Base, + ColorScheme = Colors.Error, Width = Dim.Fill() - _filterLabel.Text.Length }; _filterField.TextChanged += (str) => { // str is the OLD value - string filterText = _filterField.Text?.ToString(); try { - filterErrorLabel.Text = " "; - filterErrorLabel.ColorScheme = Colors.Base; - filterErrorLabel.Redraw(filterErrorLabel.Bounds); + string filterText = _filterField.Text?.ToString(); + filterErrorLabel.Text = ""; + filterErrorLabel.Visible = false; List itemList = GridViewHelpers.FilterData(_itemSource.GridViewRowList, filterText); _listView.Source = new GridViewDataSource(itemList); @@ -229,8 +229,7 @@ private void AddFilter(Window win) catch (Exception ex) { filterErrorLabel.Text = ex.Message; - filterErrorLabel.ColorScheme = Colors.Error; - filterErrorLabel.Redraw(filterErrorLabel.Bounds); + filterErrorLabel.Visible = true; _listView.Source = _itemSource; } }; From 4f6109dba54d9024d0c8efe0e6e390baf233c5a4 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Sat, 4 Jun 2022 01:21:11 +1200 Subject: [PATCH 11/14] Disable building Avalona components --- Build.ps1 | 2 +- scripts/azurePipelinesBuild.ps1 | 2 +- .../Microsoft.PowerShell.OutGridView.Models.csproj | 2 +- src/OutGridView.Gui/OutGridView.Gui.csproj | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index c43e139..d3e29a0 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -4,7 +4,7 @@ # To build only one, specify it using the -ModuleName paramater (e.g. Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools). # Build... -Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools +Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools # Run what was built... # pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.GraphicalTools'; Get-Module -all | Out-GridView -OutputMode Single -Title 'Imported Modules' diff --git a/scripts/azurePipelinesBuild.ps1 b/scripts/azurePipelinesBuild.ps1 index 788e64f..de98114 100644 --- a/scripts/azurePipelinesBuild.ps1 +++ b/scripts/azurePipelinesBuild.ps1 @@ -8,5 +8,5 @@ if (!(Get-Module -ListAvailable PlatyPS)) { Install-Module PlatyPS -Force -Scope CurrentUser } -Invoke-Build -Configuration Release +Invoke-Build Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools -Configuration Release Pop-Location diff --git a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj index 1de4046..b1a3539 100644 --- a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj +++ b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj @@ -1,7 +1,7 @@ - net60 + netcoreapp3.1 diff --git a/src/OutGridView.Gui/OutGridView.Gui.csproj b/src/OutGridView.Gui/OutGridView.Gui.csproj index e195417..5704498 100644 --- a/src/OutGridView.Gui/OutGridView.Gui.csproj +++ b/src/OutGridView.Gui/OutGridView.Gui.csproj @@ -2,7 +2,7 @@ Exe - net60 + netcoreapp3.1 @@ -20,7 +20,7 @@ - + From 93fe00652e38cb2f65281481cf78445649ca6315 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Sat, 4 Jun 2022 01:24:14 +1200 Subject: [PATCH 12/14] Fixed typo in pipeline script --- scripts/azurePipelinesBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/azurePipelinesBuild.ps1 b/scripts/azurePipelinesBuild.ps1 index de98114..b963139 100644 --- a/scripts/azurePipelinesBuild.ps1 +++ b/scripts/azurePipelinesBuild.ps1 @@ -8,5 +8,5 @@ if (!(Get-Module -ListAvailable PlatyPS)) { Install-Module PlatyPS -Force -Scope CurrentUser } -Invoke-Build Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools -Configuration Release +Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools -Configuration Release Pop-Location From 1ed096b90ca1a0a16d57d8edbf0eb3a08e15e8f7 Mon Sep 17 00:00:00 2001 From: Tig Kindel Date: Fri, 29 Jul 2022 21:25:49 -0700 Subject: [PATCH 13/14] removed merge files --- GraphicalTools.build.ps1.orig | 195 ---------------------------------- global.json.orig | 9 -- 2 files changed, 204 deletions(-) delete mode 100644 GraphicalTools.build.ps1.orig delete mode 100644 global.json.orig diff --git a/GraphicalTools.build.ps1.orig b/GraphicalTools.build.ps1.orig deleted file mode 100644 index dca4a2c..0000000 --- a/GraphicalTools.build.ps1.orig +++ /dev/null @@ -1,195 +0,0 @@ - -param( - [ValidateSet("Debug", "Release")] - [string]$Configuration = "Debug", - - [string[]]$ModuleName = @( - #"Microsoft.PowerShell.GraphicalTools", - "Microsoft.PowerShell.ConsoleGuiTools" ) -) - -$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows - -<<<<<<< HEAD -$script:TargetFramework = "net60" -======= -$script:TargetFramework = "net6.0" ->>>>>>> master -$script:RequiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version - -$script:ModuleLayouts = @{} -foreach ($mn in $ModuleName) { - $script:ModuleLayouts.$mn = Import-PowerShellDataFile -Path "$PSScriptRoot/src/$mn/ModuleLayout.psd1" -} - -task SetupDotNet -Before Clean, Build { - - $dotnetPath = "$PSScriptRoot/.dotnet" - $dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" } - $originalDotNetExePath = $dotnetExePath - - if (!(Test-Path $dotnetExePath)) { - $installedDotnet = Get-Command dotnet -ErrorAction Ignore - if ($installedDotnet) { - $dotnetExePath = $installedDotnet.Source - } - else { - $dotnetExePath = $null - } - } - - # Make sure the dotnet we found is the right version - if ($dotnetExePath) { - # dotnet --version can write to stderr, which causes builds to abort, therefore use --list-sdks instead. - if ((& $dotnetExePath --list-sdks | ForEach-Object { $_.Split()[0] } ) -contains $script:RequiredSdkVersion) { - $script:dotnetExe = $dotnetExePath - } - else { - # Clear the path so that we invoke installation - $script:dotnetExe = $null - } - } - else { - # Clear the path so that we invoke installation - $script:dotnetExe = $null - } - - if ($script:dotnetExe -eq $null) { - - Write-Host "`n### Installing .NET CLI $script:RequiredSdkVersion...`n" -ForegroundColor Green - - # The install script is platform-specific - $installScriptExt = if ($script:IsUnix) { "sh" } else { "ps1" } - - # Download the official installation script and run it - $installScriptPath = "$([System.IO.Path]::GetTempPath())dotnet-install.$installScriptExt" - Invoke-WebRequest "https://dot.net/v1/dotnet-install.$installScriptExt" -OutFile $installScriptPath - $env:DOTNET_INSTALL_DIR = "$PSScriptRoot/.dotnet" - - if (!$script:IsUnix) { - & $installScriptPath -Version $script:RequiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" - } - else { - & /bin/bash $installScriptPath -Version $script:RequiredSdkVersion -InstallDir "$env:DOTNET_INSTALL_DIR" - $env:PATH = $dotnetExeDir + [System.IO.Path]::PathSeparator + $env:PATH - } - - Write-Host "`n### Installation complete." -ForegroundColor Green - $script:dotnetExe = $originalDotnetExePath - } - - # This variable is used internally by 'dotnet' to know where it's installed - $script:dotnetExe = Resolve-Path $script:dotnetExe - if (!$env:DOTNET_INSTALL_DIR) { - $dotnetExeDir = [System.IO.Path]::GetDirectoryName($script:dotnetExe) - $env:PATH = $dotnetExeDir + [System.IO.Path]::PathSeparator + $env:PATH - $env:DOTNET_INSTALL_DIR = $dotnetExeDir - } - - Write-Host "`n### Using dotnet v$(& $script:dotnetExe --version) at path $script:dotnetExe`n" -ForegroundColor Green -} - -task Build { - Remove-Item $PSScriptRoot/module -Recurse -Force -ErrorAction Ignore - - foreach ($moduleLayout in $script:ModuleLayouts.Values) { - foreach ($projName in $moduleLayout.RequiredBuildAssets.Keys) { - exec { & $script:dotnetExe publish -c $Configuration "$PSScriptRoot/src/$projName/$projName.csproj" } - } - - foreach ($nativeProj in $moduleLayout.NativeBuildAssets.Keys) { - foreach ($targetPlatform in $moduleLayout.NativeBuildAssets[$nativeProj]) { - $buildPropertyParams = if ($targetPlatform -eq "win-x64") { - "/property:IsWindows=true" - } - else { - "/property:IsWindows=false" - } - exec { & $script:dotnetExe publish -c $Configuration "$PSScriptRoot/src/$nativeProj/$nativeProj.csproj" -r $targetPlatform $buildPropertyParams } - } - } - } -} - -task Clean { - #Remove Module Build - Remove-Item $PSScriptRoot/module -Recurse -Force -ErrorAction Ignore - - foreach ($moduleLayout in $script:ModuleLayouts.Values) { - foreach ($projName in $moduleLayout.RequiredBuildAssets.Keys) { - exec { & $script:dotnetExe clean -c $Configuration "$PSScriptRoot/src/$projName/$projName.csproj" } - } - - foreach ($projName in $moduleLayout.NativeBuildAssets.Keys) { - exec { & $script:dotnetExe clean -c $Configuration "$PSScriptRoot/src/$projName/$projName.csproj" } - } - } - - foreach ($mn in $ModuleName) { - Get-ChildItem "$PSScriptRoot\module\$mn\Commands\en-US\*-help.xml" -ErrorAction Ignore | Remove-Item -Force - } -} - -task LayoutModule -After Build { - foreach ($mn in $ModuleName) { - $moduleLayout = $script:ModuleLayouts[$mn] - $moduleBinPath = "$PSScriptRoot/module/$mn/" - - # Create the destination dir - $null = New-Item -Force $moduleBinPath -Type Directory - - # For each PSES subproject - foreach ($projectName in $moduleLayout.RequiredBuildAssets.Keys) { - # Get the project build dir path - $basePath = [System.IO.Path]::Combine($PSScriptRoot, 'src', $projectName, 'bin', $Configuration, $script:TargetFramework) - - # For each asset in the subproject - foreach ($bin in $moduleLayout.RequiredBuildAssets[$projectName]) { - # Get the asset path - $binPath = Join-Path $basePath $bin - - # Binplace the asset - Copy-Item -Force -Verbose $binPath $moduleBinPath - } - } - - foreach ($projectName in $moduleLayout.NativeBuildAssets.Keys) { - foreach ($targetPlatform in $moduleLayout.NativeBuildAssets[$projectName]) { - $destDir = Join-Path $moduleBinPath $projectName $targetPlatform - - $null = New-Item -Force $destDir -Type Directory - - # Get the project build dir path - $publishPath = [System.IO.Path]::Combine($PSScriptRoot, 'src', $projectName, 'bin', $Configuration, $script:TargetFramework, $targetPlatform, "publish\*" ) - - Write-Host $publishPath - # Binplace the asset - Copy-Item -Recurse -Force $publishPath $destDir - } - } - - Copy-Item -Force "$PSScriptRoot/README.md" $moduleBinPath - Copy-Item -Force "$PSScriptRoot/LICENSE.txt" $moduleBinPath - } -} - -task BuildCmdletHelp { - foreach ($mn in $ModuleName) { - New-ExternalHelp -Path "$PSScriptRoot/docs/$mn" -OutputPath "$PSScriptRoot/module/$mn/en-US" -Force - } -} - -task PackageModule { - foreach ($mn in $ModuleName) { - Remove-Item "$PSScriptRoot/$mn.zip" -Force -ErrorAction Ignore - Compress-Archive -Path "$PSScriptRoot/module/$mn/" -DestinationPath "$mn.zip" -CompressionLevel Optimal -Force - } -} - -task UploadArtifacts -If ($null -ne $env:TF_BUILD) { - foreach ($mn in $ModuleName) { - Copy-Item -Path "$PSScriptRoot/$mn.zip" -Destination "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/$mn-$($env:AGENT_OS).zip" - } -} - -task . Clean, Build, BuildCmdletHelp, PackageModule, UploadArtifacts diff --git a/global.json.orig b/global.json.orig deleted file mode 100644 index df492fc..0000000 --- a/global.json.orig +++ /dev/null @@ -1,9 +0,0 @@ -{ - "sdk": { -<<<<<<< HEAD - "version": "6.0.203" -======= - "version": "6.0.100" ->>>>>>> master - } -} From 7e04d8111ec3b39146f6dcd787155fc3ce2c3342 Mon Sep 17 00:00:00 2001 From: Tig Kindel Date: Fri, 29 Jul 2022 21:29:30 -0700 Subject: [PATCH 14/14] removed orig files --- .vscode/launch.json.orig | 45 ------------------- ...oft.PowerShell.ConsoleGuiTools.csproj.orig | 31 ------------- ...soft.PowerShell.GraphicalTools.csproj.orig | 23 ---------- ....PowerShell.OutGridView.Models.csproj.orig | 13 ------ .../OutGridView.Gui.csproj.orig | 36 --------------- 5 files changed, 148 deletions(-) delete mode 100644 .vscode/launch.json.orig delete mode 100644 src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj.orig delete mode 100644 src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj.orig delete mode 100644 src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj.orig delete mode 100644 src/OutGridView.Gui/OutGridView.Gui.csproj.orig diff --git a/.vscode/launch.json.orig b/.vscode/launch.json.orig deleted file mode 100644 index 97134ad..0000000 --- a/.vscode/launch.json.orig +++ /dev/null @@ -1,45 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": ".NET Core Launch (console)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", -<<<<<<< HEAD - "program": "${workspaceFolder}/Cmdlet/bin/Debug/net60/win10-x64/OutGridViewCmdlet.dll", -======= - "program": "${workspaceFolder}/Cmdlet/bin/Debug/net6.0/win10-x64/OutGridViewCmdlet.dll", ->>>>>>> master - "args": [], - "cwd": "${workspaceFolder}/Cmdlet", - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": ".NET Core Launch (application)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", -<<<<<<< HEAD - "program": "${workspaceFolder}/Application/bin/Debug/net60/win10-x64/OutGridViewApplication.dll", -======= - "program": "${workspaceFolder}/Application/bin/Debug/net6.0/win10-x64/OutGridViewApplication.dll", ->>>>>>> master - "args": [], - "cwd": "${workspaceFolder}/Application", - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}", - "justMyCode": false - } - ] -} \ No newline at end of file diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj.orig b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj.orig deleted file mode 100644 index f2fc5d3..0000000 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj.orig +++ /dev/null @@ -1,31 +0,0 @@ - - - -<<<<<<< HEAD - net60 - - - - - - - -======= - net6.0 - - - - - - ->>>>>>> master - - - - - - - - - - diff --git a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj.orig b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj.orig deleted file mode 100644 index 8e58c0e..0000000 --- a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj.orig +++ /dev/null @@ -1,23 +0,0 @@ - - - -<<<<<<< HEAD - net60 -======= - net6.0 ->>>>>>> master - - - - - - - - - - - - - - - diff --git a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj.orig b/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj.orig deleted file mode 100644 index 268b32a..0000000 --- a/src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj.orig +++ /dev/null @@ -1,13 +0,0 @@ - - - -<<<<<<< HEAD - netcoreapp3.1 -======= - net6.0 ->>>>>>> master - - - - - diff --git a/src/OutGridView.Gui/OutGridView.Gui.csproj.orig b/src/OutGridView.Gui/OutGridView.Gui.csproj.orig deleted file mode 100644 index e9a84a4..0000000 --- a/src/OutGridView.Gui/OutGridView.Gui.csproj.orig +++ /dev/null @@ -1,36 +0,0 @@ - - - - Exe -<<<<<<< HEAD - netcoreapp3.1 -======= - net6.0 ->>>>>>> master - - - - - %(Filename) - - - Designer - - - - - - - - - - - - - - - - - - -