Compiling an IronPython WPF project to exe Compiling an IronPython WPF project to exe python python

Compiling an IronPython WPF project to exe


Use pyc.py to produce app.exe and don't forget to include app.dll and IronPython libraries.

As for XAML - I've created project just for .xaml files that I compile in VS and then use them from IronPython. For example:

<ResourceDictionary.MergedDictionaries>  <ResourceDictionary Source="/CompiledStyle;component/Style.xaml" /> </ResourceDictionary.MergedDictionaries> 


It "boils down to IL", but it isn't compatible with the IL that C# code produces, so it can't be directly compiled to a standalone .exe file.You'll need to use pyc.py to compile your code to a stub EXE with the DLL that CompileModules creates.Then distribute those files with IronPython.dll, IronPython.Modules.dll, Microsoft.Dynamic.dll, Microsoft.Scripting.Debugging.dll, Microsoft.Scripting.dll, and of course the XAML file.

To compile other files, just add them as arguments:ipy.exe pyc.py /main:app.py /target:winexe another.py another2.py additional.py


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. It ought to work for WPF too as it bundles WPF support.