Using assemblies

If an assembly is listed in the using statement for a script, it will be loaded. For example, the System.Windows.Forms may be loaded:

using assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 

Add-Type is able to do much the same thing:

Add-Type -AssemblyName 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 

If a specific version is not required, the shorter name for the assembly may be used:

using assembly System.Windows.Forms 

The using assembly command will load assemblies from a specific path if one is supplied:

using assembly 'C:SomeDirsomeAssembly.dll' 

PowerShell allows the using assembly statement any number of times in a script (one or more assemblies can be loaded in a single script).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.97.75