Gwynge
Gwynge

Reputation: 160

Calling .net 1.1 from Powershell

I am trying to reference a .net 1.1 assembly from Powershell. I believe I have tried both 1.0 and 2.0 and I have tried on Win XP and Win 7 64 bit.

add-type -path "path-to-dll"

I then get back the following error:

Add-Type : Unable to load one or more of the requested types. Retrieve
the LoaderExceptions property for more information. At line:1 char:9
+ add-type <<<<  -path "C:\Program Files\Propel Systems\Cimera eval\cimera common.dll"
    + CategoryInfo          : NotSpecified: (:) [Add-Type], ReflectionTypeLoadException
    + FullyQualifiedErrorId : System.Reflection.ReflectionTypeLoadException,Microsoft.PowerShell.Commands.AddTypeCommand

I have scoured Google as to whether Powershell supports 1.1 or not but cannot find an answer. Does it?

Secondly the message says "Retrieve the LoaderExceptions property..". But I can find absolutely no reference ANYWHERE as to HOW.

Upvotes: 2

Views: 705

Answers (1)

Andy Arismendi
Andy Arismendi

Reputation: 52689

Try using the LoadFrom method.

[System.Reflection.Assembly]::LoadFrom("C:\Your_DotNet_1.1.dll")

Just making my comment an answer since it works.

Upvotes: 1

Related Questions