diff --git a/powershell/.gitignore b/powershell/.gitignore new file mode 100644 index 000000000000..a6cbe1fd9504 --- /dev/null +++ b/powershell/.gitignore @@ -0,0 +1,2 @@ +extractor/**/bin/* +extractor/**/obj/* diff --git a/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj b/powershell/extractor/Microsoft.Extractor.Tests/Microsoft.Extractor.Tests.csproj index 3e8fcaecf3e9..5d49d1801c85 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 + 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 2132264dc41b..5241d4c420fe 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 + 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 a85a50364e45..d77074589b3d 100644 --- a/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs +++ b/powershell/extractor/Semmle.Extraction.PowerShell/Entities/ScriptBlockEntity.cs @@ -15,7 +15,8 @@ private ScriptBlockEntity(PowerShellContext cx, ScriptBlockAst fragment) 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 @@ public override void Populate(TextWriter trapFile) { 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 d5f0804e8cf0..4faf1a352573 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 + 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 3dee0905229e..c4a0dcffd123 100644 --- a/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj +++ b/powershell/extractor/Semmle.Extraction/Semmle.Extraction.csproj @@ -1,7 +1,7 @@  - net7.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 b2fa737f7c45..995335f833ab 100644 --- a/powershell/extractor/Semmle.Util/Semmle.Util.csproj +++ b/powershell/extractor/Semmle.Util/Semmle.Util.csproj @@ -1,7 +1,7 @@ - net7.0 + net9.0 Semmle.Util Semmle.Util false