il-repack: WPF App not starting after IL Repack

Hi

We tried to use ILRepack to get a single exe of our WPF application, but it didn’t work and we are not sure how to fix it - maybe we miss something?

The full source of the application can be found here: https://github.com/Sevitec/oneoffixx-connectclient/

Repo-Steps:

  1. Build the application via the build.ps1
  2. Under this path “.\Windows\src\OneOffixx.ConnectClient.WinApp\bin\Release” you should see this: image
  3. Now we invoke ILRepack like this:

(C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\ must be replaced with your clone directory)

ILRepack.exe /verbose /log /out:C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\bin\Release\merged\Merged.exe C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\OneOffixx.ConnectClient.WinApp.exe C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\System.Windows.Interactivity.dll C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\MahApps.Metro.dll C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\Microsoft.Practices.ServiceLocation.dll C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\ICSharpCode.AvalonEdit.dll C:\Users\amacher\Documents\GitHub\oneoffixx-connectclient\Windows\src\OneOffixx.ConnectClient.WinApp\Release\Debug\FontAwesome.WPF.dll

The full log output can be found here

  1. Result is a Merged.exe, but it fails to start.

The Windows-Eventlog tells me this:

Anwendung: Merged.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.IO.FileNotFoundException
bei System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
bei System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
bei System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
bei System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
bei System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(System.String, System.String, System.String)
bei MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(System.Uri, System.String ByRef, Boolean ByRef)
bei MS.Internal.AppModel.ResourceContainer.GetPartCore(System.Uri)
bei System.IO.Packaging.Package.GetPartHelper(System.Uri)
bei System.IO.Packaging.Package.GetPart(System.Uri)
bei System.Windows.Application.GetResourceOrContentPart(System.Uri)
bei System.Windows.Application.LoadComponent(System.Object, System.Uri)
bei OneOffixx.ConnectClient.WinApp.App.InitializeComponent()
bei OneOffixx.ConnectClient.WinApp.App.Main()

Any ideas?

Note that we don’t reference ILRepack directly - we saw this in your sample application, but even with the reference it didn’t worked.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 5
  • Comments: 22 (5 by maintainers)

Most upvoted comments

Correct

Ah - will try to change it and see if MahApps will take it via a PR. Just to make sure I understand - such resources in XAML are detected by ILRepack and handled correctly, right?

https://github.com/batzen/MahApps.Metro/blob/master/src/MahApps.Metro.Samples/MahApps.Metro.Demo/MahApps.Metro.Demo.Shared/App.xaml#L10-L16

Hard coded resources like pack://application:,[ANYTHING THAT WILL BE MERGED] in code are problematic, right?