Zippo
Zippo

Reputation: 16440

Compiling an IronPython code to EXE or DLL

Can I compile an IronPython code to EXE or DLL in a .NET runtime?

Upvotes: 9

Views: 10166

Answers (3)

jcao219
jcao219

Reputation: 2858

Simply use clr.CompileModules in an IronPython script to convert it to a dll file. Or you can use pyc.py (found inside of your IronPythonInstallDirectory\Tools\Scripts) which can also generate an exe for you also.

Upvotes: 6

Niall Douglas
Niall Douglas

Reputation: 9772

Yes you can! I posted a Python script which can take an IronPython file, figure out its dependencies and compile the lot into a standalone binary at Ironpython 2.6 .py -> .exe. Hope you find it useful.

Upvotes: 0

Jonathan Allen
Jonathan Allen

Reputation: 70337

If I really, really needed that I would create a wrapper DLL/EXE in another language. The Python code can then be stored as a resource in the DLL that is loaded when the assembly is first accessed.

Upvotes: 1

Related Questions