picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.57k stars 325 forks source link

not support ilmerge? #567

Open ismlsmile opened 7 years ago

ismlsmile commented 7 years ago

I'm not sure if the problem is with eto.forms or ilmerge. When I use ilmerge to merge Eto*.dll into the exe file, the merge is ok, but when I run the output exe, it just crashes.

ismlsmile commented 7 years ago

The exception is "Platform instance is null. Have you created your application?" in "Eto.Platform.get_Instance"

cwensley commented 7 years ago

This is probably because when you are using auto-detection, it cannot load the appropriate DLL as it does it dynamically. I'm not sure what you'll have to do to get around this, but most likely you'll have to create the particular platform class manually.. for example:

Platform platform;

if (EtoEnvironment.Platform.IsWindows) 
    platform = new Eto.Wpf.Platform();
else if (EtoEnvironment.Platform.IsMac)
    platform = new Eto.Mac.Platform();
else if (EtoEnvironment.Platform.IsLinux)
    platform = new Eto.Gtk.Platform();
else
    throw new Exception("Could not detect platform");

new Application(platform).Run(new MainForm());

I'm not sure if this will work 100% as it may have problems referencing each platform.

Hope this helps! Curtis.

ismlsmile commented 7 years ago

Thanks for your reply, I tried but it could not work, the exception changes to:

Current operation is valid only when the underlying type on a XamlType is known, but it is unknown for '{http://schema.picoe.ca/eto.forms}Label'

SlowLogicBoy commented 7 years ago

I'm having the same problem, however I use only Eto.Wpf.

For this I use il-repack. There are few problems:

  1. Eto.Wpf resources gets copied incorrectly
  2. Eto.Wpf resources are copied with name as for Eto.Wpf not with the new assembly name
  3. Eto.Wpf.Forms.ApplicationHandler.ApplyThemes uri is calling Eto.Wpf

I resolved this issue by using dnlib Here is the hack: MyModulePatcher.csx

Script is run by using RoslynPad

I hope this will help someone. There might be more issues, but for me these changes were enough.