I want to compile my IronPython WPF based app into a .exe file. I looked up the net for solutions and found this on SO:
Compiling an IronPython WPF project to exe.
I found this modified pyc.py file better than the original as I do not have to pass the names of all the files in the project to pyc at the command line. When I run this, I get a dll and an executable. I also included the other dll files mentioned on the above discussion, like IronPython.dll. There is only one problem. I have the following at the top of my main file code:
import wpf
from System.Windows import MessageBox, Application, Window
The app runs fine on VS2010 but the executable seems not to be able开发者_运维百科 to find any dll named wpf or Window. I have this file called IronPython.Wpf.dll which I included in the folder but that does not seem to work. What dll am I missing here? Or is there any other way I can solve my problem?
You should add
import clr
clr.AddReference('IronPython.Wpf')
And make sure you put IronPython.Wpf.dll
, from the IronPython's install directory in the same directory as your main script.
I'm still getting an Exception related with STA Threads, but that's for other question.
Edit: Look at this for the STA error
精彩评论