Skip to content

Commit d2d76ec

Browse files
snorrkSnorri Gislason
andauthored
PSCmdLet to output target framework for an assembly (#3435)
* PS cmdlet to output target framework for an assembly * Add GetTargetFramework to psd1 --------- Co-authored-by: Snorri Gislason <[email protected]>
1 parent 247f161 commit d2d76ec

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Management.Automation;
2+
3+
using ICSharpCode.Decompiler.CSharp;
4+
using ICSharpCode.Decompiler.Metadata;
5+
6+
namespace ICSharpCode.Decompiler.PowerShell
7+
{
8+
[Cmdlet(VerbsCommon.Get, "TargetFramework")]
9+
[OutputType(typeof(string))]
10+
public class GetTargetFramework : PSCmdlet
11+
{
12+
[Parameter(Position = 0, Mandatory = true)]
13+
public CSharpDecompiler Decompiler { get; set; }
14+
15+
protected override void ProcessRecord()
16+
{
17+
MetadataFile module = Decompiler.TypeSystem.MainModule.MetadataFile;
18+
WriteObject(module.Metadata.DetectTargetFrameworkId());
19+
}
20+
}
21+
}

ICSharpCode.Decompiler.PowerShell/manifest.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
'Get-DecompiledSource',
6969
'Get-DecompiledTypes',
7070
'Get-Decompiler',
71-
'Get-DecompilerVersion'
71+
'Get-DecompilerVersion',
72+
'Get-TargetFramework'
7273
)
7374

7475
# Variables to export from this module

0 commit comments

Comments
 (0)