[IronPython] Assembly differences in Beta5

Dino Viehland dinov at exchange.microsoft.com
Thu Apr 6 04:42:08 CEST 2006


This should work:

import clr
import System.Reflection
clr.AddReference(System.Reflection.Assembly.LoadFrom('/code/dlls/Microsoft.Office.Interop.PowerPoint.dll'));
clr.AddReference(System.Reflection.Assembly.LoadFrom('/code/dlls/office.dll));
import Microsoft.Office.Interop.PowerPoint as PP
import Microsoft.Office.Core as Core


the key is the change from AddAssembly to AddReference.

It's unfortunate you were using AddAssembly as it's really only there for compiled scripts to add themselves into the list of available assemblies (and the way we do that changed from using references to assemblies in beta 5), not for usage in scripts.  It takes a string now instead of an assembly, which is the reason why you're getting that exception.  We should move this out of clr to avoid future confusion.


________________________________
From: users-bounces at lists.ironpython.com On Behalf Of Steven Drucker
Sent: Wednesday, April 05, 2006 6:40 PM
To: Discussion of IronPython
Subject: [IronPython] Assembly differences in Beta5


With the switch to Beta5, my assembly loading is not working (again).
Among other modules, I'm using the Microsoft Office Interop modules:
I used to be able to do the following:
import clr
import System.Reflection
clr.AddAssembly(System.Reflection.Assembly.LoadFrom('/code/dlls/Microsoft.Office.Interop.PowerPoint.dll'));
clr.AddAssembly(System.Reflection.Assembly.LoadFrom('/code/dlls/office.dll));
import Microsoft.Office.Interop.PowerPoint as PP
import Microsoft.Office.Core as Core
now, this says, TypeError, bad args for method (on the AddAssembly line)
I've also used just about every combination of AddReferenceByName, PartialName, FromFile, LoadAssembly, etc. that I can think of.
None of them work anymore...usually, they crap out on the import.
What's the preferred/correct/possible way of doing this now?
Thanks!
--Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060405/66fd0f6a/attachment.html>


More information about the Ironpython-users mailing list