views:

68

answers:

1

Hi folks, I create dll in c# and i want to use it in powershell, but without reflection. i know i can load the dll using:

[Reflection.Assembly]::LoadFile("MyDll.dll")  

But i don't want to use reflection. is there any simple way to do it? something like add reference to this dll... Thanks in advance

+1  A: 

In PowerShell 2.0 the cmdlet Add-Type is designed for this, for example:

Add-Type -Path "$env:Xyz\bin\Npgsql.dll"

(it’s more likely that under the covers it calls the same LoadFile but this way is more PowerShell-ish)

Roman Kuzmin

related questions