Error on Import-Module

Feb 2, 2012 at 6:20 AM

I'm getting the following error when I attempt to import-module in my console.

PS C:\Users\Joel> Import-Module odata

Import-Module : Could not load file or assembly 'file:///E:\PowerShell\Modules\odata\bin\CodeOwls.PowerShell.OData.Provider.dll' or one ofits dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

At line:1 char:14+

Import-Module <<<<  odata

    + CategoryInfo          : NotSpecified: (:) [Import-Module], BadImageFormatException

    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand

I get this error regardless of x86 or x64 version of the console. Wheter I am running as admin or not. I also tried STA for kicks. I have other modules installed at that location and others load and function fine.

I've got a pretty standard Win7 64bit build, PowerShell v2, all latest patches, including those for .net 4 (and 3.5, 3.0, and 2 are present as well). Nothing on the site seems to indicate this is for PowerShell v3 or .NET 4.5 is required.

Thanks,

Joel.

Coordinator
Feb 2, 2012 at 4:30 PM

My bad.  I build the software locally using .NET 4 to allow debuggery, but I neglected the build step that reverts the project to 3.5; I've replaced the module archive in the release, please try again.  And thanks for your patience.

 

Jim

Aug 1, 2013 at 5:13 AM
I am running into a similar issue on a Windows 8 PC:

Import-Module : Could not load file or assembly
'file:///C:\windows\system32\WindowsPowerShell\v1.0\Modules\OData\bin\CodeOwls.PowerShell.OData.Provider.dll'
or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
  • Import-Module OData
  • ~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadException
    • FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
What am I missing here?