Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clr.AddReferenceToFile() fails in IronPython 2.7

Can someone explain why this code:

import sys
sys.path.append("C:\\WINDOWS\\system32")

import clr
clr.AddReferenceToFile("wiimotelib.dll")

works fine with IronPython 2.6, but fails in IronPython 2.7 alpha 1 with an IOException, and the message:

Could not add reference to assembly wiimotelib.dll

Is this new behaviour in 2.7, or is it an alpha release bug?

like image 685
Charles Anderson Avatar asked Sep 11 '10 20:09

Charles Anderson


2 Answers

Could this be a .NET 2 vs .NET 4 problem? IronPython 2.7A1 is .NET 4.0 only. 2.6 had both .NET 2 and .NET 4 versions. If the assembly is a .NET 2 assembly it might not load on the .NET 4 CLR.

like image 187
Dino Viehland Avatar answered Nov 10 '22 23:11

Dino Viehland


You have to recompile the WiimoteLib Assembly. I've had the same problem. After recompilation it was gone.

like image 40
Rainer Schuster Avatar answered Nov 10 '22 21:11

Rainer Schuster