Exploring .NET assemblies
With .NET, an assembly holds compiled code which .NET can run. An assembly can either be a Dynamic Link Library (DLL) or an executable. Cmdlets and .NET classes are contained in DLLs, as you see in this recipe. Each assembly also contains a manifest which describes what is in the assembly, along with compiled code.
Most PowerShell modules and commands make use of assemblies of compiled code. When PowerShell loads any module, the module manifest (the .PSD1
file) lists the assemblies which make up the module. For example, the Microsoft.PowerShell.Management
module provides many core PowerShell commands, such as Get-ChildItem
and Get-Process
. This module's manifest lists a nested module (that is, Microsoft.PowerShell.Commands.Management.dll
) as the assembly containing the actual commands.
A great feature of PowerShell is the ability for you to invoke a .NET class method directly or to obtain a static .NET class value. The syntax for calling a .NET...