[Python.NET] how can I build an assembly I can AddReference()?

Brandon Craig Rhodes brandon at rhodesmill.org
Fri May 28 22:52:15 CEST 2010


I can now build my assembly successfully and import it into Python!

Upon closer inspection, I discovered that uninstalling Visual Studio
2010 did *not* actually remove the compilation subsystem I was using, it
turns out, from C:\Windows\Microsoft.NET\Framework\v4.0.30319.  And so
my DLL was still coming out based on a too-recent runtime version.

Once I replaced my %PATH% with:


and re-ran "csc /t:library Brandon.cs", I got a DLL that imports and
runs just fine from inside of Python!

So it was just my ignorance of how Windows development works, and of
which paths and installed components determine the runtime version of a
built component, that seems to have caused the problem.  This experience
over the last two days - of, in effect, staring at a bank of knobs and
blinking lights and having no idea which knobs will have what effects -
really helped me have sympathy as I was simultaneously answering some
questions from a friend who is trying to figure out how to compile
Python on a Mac when he has never dealt with "configure", "make", or
shared libraries before.  It made it easier to remember that what seemed
so sensible and obvious to me was a complete blank wall of ignorance and
mystery to him. :-)

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the PythonDotNet mailing list