From ee2688fbcb6bb3f1fb9e07b9cade107282995b45 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:30:05 -0800 Subject: [PATCH 1/3] Update project to net 8. --- .../Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj | 2 +- .../Semmle.Extraction.PowerShell.Standalone.csproj | 2 +- .../Semmle.Extraction.PowerShell.csproj | 2 +- powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj | 2 +- powershell/extractor/Semmle.Util/Semmle.Util.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj b/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj index 3e8fcaecf3e..89cd1c219d6 100644 --- a/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj +++ b/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj b/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj index 2132264dc41..4912f19748b 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj +++ b/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 Semmle.Extraction.PowerShell.Standalone Semmle.Extraction.PowerShell.Standalone false diff --git a/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj b/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj index d5f0804e8cf..5ee194625a8 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj +++ b/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 Semmle.Extraction.PowerShell Semmle.Extraction.PowerShell false diff --git a/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj b/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj index 3dee0905229..c8676142273 100644 --- a/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj +++ b/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 Semmle.Extraction Semmle.Extraction false diff --git a/powershell/extractor/Semmle.Util/Semmle.Util.csproj b/powershell/extractor/Semmle.Util/Semmle.Util.csproj index b2fa737f7c4..f31ba3a6acf 100644 --- a/powershell/extractor/Semmle.Util/Semmle.Util.csproj +++ b/powershell/extractor/Semmle.Util/Semmle.Util.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 Semmle.Util Semmle.Util false From 43cdff9725b111ff55eefe6a2ade0ffd866ffea2 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:36:35 -0800 Subject: [PATCH 2/3] Update dependencies. Update projects to use NET 9.0 (required by System.Management 7.5 and later) --- .../Microsoft.Extractor.Tests.csproj | 10 +++++----- .../Semmle.Extraction.PowerShell.Standalone.csproj | 2 +- .../Entities/ScriptBlockEntity.cs | 7 ++----- .../Semmle.Extraction.PowerShell.csproj | 4 ++-- .../Semmle.Extraction/Semmle.Extraction.csproj | 6 +++--- powershell/extractor/Semmle.Util/Semmle.Util.csproj | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj b/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj index 89cd1c219d6..5d49d1801c8 100644 --- a/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj +++ b/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable @@ -10,13 +10,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj b/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj index 4912f19748b..5241d4c420f 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj +++ b/powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Semmle.Extraction.PowerShell.Standalone.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 Semmle.Extraction.PowerShell.Standalone Semmle.Extraction.PowerShell.Standalone false diff --git a/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs b/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs index a85a50364e4..d77074589b3 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs +++ b/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs @@ -15,7 +15,8 @@ namespace Semmle.Extraction.PowerShell.Entities public ScriptBlockAst Fragment => Symbol.Item1; public override void Populate(TextWriter trapFile) { - trapFile.script_block(this, Fragment.UsingStatements.Count, Fragment.ScriptRequirements?.RequiredModules.Count ?? 0, Fragment.ScriptRequirements?.RequiredAssemblies.Count ?? 0, Fragment.ScriptRequirements?.RequiredPSEditions.Count ?? 0, Fragment.ScriptRequirements?.RequiresPSSnapIns.Count ?? 0); + // RequiresPsSnapins Property was removed in System.Management package 7.4.x and later + trapFile.script_block(this, Fragment.UsingStatements.Count, Fragment.ScriptRequirements?.RequiredModules.Count ?? 0, Fragment.ScriptRequirements?.RequiredAssemblies.Count ?? 0, Fragment.ScriptRequirements?.RequiredPSEditions.Count ?? 0, 0); trapFile.script_block_location(this, TrapSuitableLocation); if (Fragment.ScriptRequirements is not null){ trapFile.script_block_requires_elevation(this, Fragment.ScriptRequirements.IsElevationRequired); @@ -40,10 +41,6 @@ namespace Semmle.Extraction.PowerShell.Entities { trapFile.script_block_required_ps_edition(this, i, Fragment.ScriptRequirements.RequiredPSEditions[i]); } - for (int i = 0; i < Fragment.ScriptRequirements.RequiresPSSnapIns.Count; i++) - { - trapFile.script_block_requires_ps_snapin(this, i, Fragment.ScriptRequirements.RequiresPSSnapIns[i].Name, Fragment.ScriptRequirements.RequiresPSSnapIns[i].Version.ToString()); - } } if (Fragment.ParamBlock is not null) { diff --git a/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj b/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj index 5ee194625a8..4faf1a35257 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj +++ b/powershell/extractor/Semmle.Extraction.PowerShell/Semmle.Extraction.PowerShell.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Semmle.Extraction.PowerShell Semmle.Extraction.PowerShell false @@ -17,7 +17,7 @@ - + diff --git a/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj b/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj index c8676142273..c4a0dcffd12 100644 --- a/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj +++ b/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Semmle.Extraction Semmle.Extraction false @@ -15,8 +15,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/powershell/extractor/Semmle.Util/Semmle.Util.csproj b/powershell/extractor/Semmle.Util/Semmle.Util.csproj index f31ba3a6acf..995335f833a 100644 --- a/powershell/extractor/Semmle.Util/Semmle.Util.csproj +++ b/powershell/extractor/Semmle.Util/Semmle.Util.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 Semmle.Util Semmle.Util false From b018fb9c8f1257eedce699a039187d1484f88f46 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:40:27 -0800 Subject: [PATCH 3/3] Add gitignore for build artifacts from powershell extractor --- powershell/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 powershell/.gitignore diff --git a/powershell/.gitignore b/powershell/.gitignore new file mode 100644 index 00000000000..a6cbe1fd950 --- /dev/null +++ b/powershell/.gitignore @@ -0,0 +1,2 @@ +extractor/**/bin/* +extractor/**/obj/*