LoadFile Method
.NET Framework Class Library
Assembly..::.LoadFile Method

Loads the contents of an assembly file.

  NameDescription
Public methodStatic memberLoadFile(String)Loads the contents of an assembly file on the specified path.
Public methodStatic memberLoadFile(String, Evidence)Loads an assembly given its path, loading the assembly into the domain of the caller using the supplied evidence.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
LoadFile sample using PowerShell      Thomas Lee   |   Edit   |   Show History
# Get-AssemblyVersion.ps1
# Sample using PowerShell
# Thomas Lee - tfl@psp.co.uk

# Define the assembly we want to load - a random reference assembly from SDK 3.0
$Pshfile = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\system.speech.dll"

# Now load the assembly
$Myasm = [System.Reflection.Assembly]::Loadfile($Pshfile)

# Get name, version and display the results
$Aname = $Myasm.GetName()
$Aver = $Aname.version

# display results
"Assembly: {0} has version number of: {1}" -f $Aname.name, $aver

This script produces the following output:
PS C:\foo> .\get-assemblyversion.ps1
Assembly: System.Speech has version number of: 3.0.0.0
Processing
Page view tracker