I have no problems using AForge classes in a Windows Form application in Visual Studio. I am now trying to use them in Windows PowerShell.
[Reflection.Assembly]::LoadFile('C:\Program Files\AForge.NET\IPLab\References\AForge.NET\AForge.Imaging.dll')
gives:
GAC Version Location
--- ------- --------
False v2.0.50727 C:\Program Files\AForge.NET\IPLab\References\AForge.NET\AForge.Imaging.dll
It says v2.0.50727 even though the AForge.Imaging.dll File Version and Product Version are both 2.2.4.0. But I have no problems executing the following to instantiate an AForge.Imaging.UnmanagedImage object $umi (where $bmdata is an Drawing.BitMapData object):
$umi = new-object Aforge.Imaging.UnmanagedImage $bmdata
But the moment I tried to access the $umi object, for example $umi.GetType(), I get the following error:
The following exception occurred while retrieving member "GetType": "Could not load file or assembly 'AForge, Version=2.2.4.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' or one of its dependencies. The system cannot find the file specified."
At line:1 char:13
+ $umi.GetType <<<< ()
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember
What could be wrong? Thanks.
The “AForge.Imaging.dll” library depends on the following libraries that must also be loaded;
run the following PowerShell command to list the currently loaded assemblies and verify you have the necessary bits.
Here were my results:
I can confirm this worked for me.