Skip to content

Commit 1792502

Browse files
author
Snorri Gislason
committed
PS cmdlet to output target framework for an assembly
1 parent fa409a8 commit 1792502

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
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+
}

0 commit comments

Comments
 (0)