I am playing around with some PowerShell V3 stuff and needed to use Ngen.exe to do a native generation of an assembly and move it to the Global Assembly Cache. So where is it? I could have wandered around in the Windows folder, but instead decided to ask .NET itself, using PowerShell.
The .NET class System.Runtime.InteropServices.RuntimeEnvironment contains several static methods that return information about the CLR environment. There are three that are of possible interest to the IT Pro:
FromGlobalAccessCache – this static method tests an assembly to determine if it ewas loaded from the GAC.
GetRuntimeDirectory – this static method returns the folder name where the CLR was installed. This folder contains Ngen, the C# complier, and other .NET tools.
GetSystemVersion – this method returns the version number of the .NET Framework
From PowerShell Version 2, this looks like:
If you are using the beta version of PowerShell V3, you might see this:
File under: Interesting things you can do with .NET and PowerShell.
No comments:
Post a Comment