I have trouble merging IronPython.dll, IronPython.Modules.dll, Microsoft.Dynamic.dll, Microsoft.Scripting.dll and Microsoft.Scripting.Metadata.dll into my application.
The first error i got while trying to execute a python script was:
MissingMemberException: "'NullImporter' object has no attribute 'find_module'"
This was resolved by omitting the /internalize Parameter of ILMerge. It seems that IronPython needs certain types to be public in order to function.
But it didn't help much, now i got:
ImportException: "No module named clr"
The exception in both cases is thrown for the first line of my script, which of course is just an "import clr".
Sadly, it seems like extremely dynamic runtimes such as IronPython are going to be the least cooperative when it comes to working after an ILMerge.
You might consider doing some of the assembly embedding tricks that single-exe projects like LINQPad do.
ResolveEventHandler
with theAppDomain.CurrentDomain.AssemblyResolve
event.You do part 3 as follows:
If you need more help, you can poke around in LINQPad.exe and look at
LinqPad.Program.AddLINQPadAssemblyResolver()
andLinqPad.Program.FindAssem()
.Update: Just found a blog post by Jeffrey Richter that gives more details on this approach.