How to fix exception: " System.IO.FileNotFoundException" after run published WPF app?

1

I published a WPF app. But when I setup and ran it in different computer, there is nothing display in the desktop. I tried to use EventViewer app and then explore some errors(I also tried in my computer, It worked OK with no exception and error): enter image description here

Source(.Net runtime) have Error:

 Exception Info: System.IO.FileNotFoundException

   at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.RuntimeAssembly.InternalLoad(System.String, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean)
   at System.Reflection.RuntimeAssembly.InternalLoad(System.String, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean)
   at System.Reflection.Assembly.Load(System.String)
   at DevExpress.Utils.AssemblyHelper.GetAssembly(System.String)
   at DevExpress.Xpf.Core.Theme.GetAssembly()
   at DevExpress.Xpf.Core.Theme.get_Assembly()
   at DevExpress.Xpf.Core.ThemedElementsDictionary.GetThemeAssembly(System.String)
   at DevExpress.Xpf.Core.ThemedElementsDictionary.ForceThemeKeysLoading(System.String)
   at DevExpress.Xpf.Core.ThemeManager.ChangeTheme(System.Windows.DependencyObject, System.String, Boolean, Boolean, System.String)
   at DevExpress.Xpf.Core.ThemeManager.ThemeNamePropertyChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
   at System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
   at System.Windows.DependencyObject.SetCurrentValue(System.Windows.DependencyProperty, System.Object)
   at DevExpress.Xpf.Core.ThemeManager.DevExpress.Xpf.Utils.Themes.IThemeManager.SetThemeName(System.Windows.DependencyObject, System.String)
   at DevExpress.Xpf.Utils.Themes.GlobalThemeHelper.SetGlobalTheme(System.Windows.FrameworkElement)
   at DevExpress.Xpf.Utils.Themes.GlobalThemeHelper.AssignApplicationThemeName(System.Windows.FrameworkElement)
   at DevExpress.Xpf.Utils.Themes.GlobalThemeHelper.EnumerateSafe(System.Windows.WindowCollection, System.Action`1<System.Windows.Window>)
   at DevExpress.Xpf.Utils.Themes.GlobalThemeHelper.SetApplicationWindows()
   at DevExpress.Xpf.Utils.Themes.GlobalThemeHelper.SetWindowsApplicationThemeName()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Thr

Source Application have Error:

 Faulting application name: WpfApplication5.exe, version: 1.0.0.0, time stamp: 0x5b491a6b
Faulting module name: KERNELBASE.dll, version: 10.0.16299.309, time stamp: 0xd3aa915c
Exception code: 0xe0434352
Fault offset: 0x001008f2
Faulting process id: 0x2ffc
Faulting application start time: 0x01d41bc5ee509362
Faulting application path: C:\Program Files (x86)\WPF5\WPF5\WpfApplication5.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll

I continued in one more computer. There was a dialog my app "Has stopped working" display, when clicked in detail button . It showed me exception occured with: mscorlib.dll

I wasted a week to search information to fix it. But I could not solve it. Thank to Good bro to help me!

c#
wpf
mscorlib
asked on Stack Overflow Jul 15, 2018 by j.johh • edited Jul 15, 2018 by j.johh

1 Answer

0

It seems that you have some absolute path on the code, i.e: "C:/Users/X/Desktop/ ..." Try to change absolute paths with relative paths.

answered on Stack Overflow Jul 15, 2018 by Pepv

User contributions licensed under CC BY-SA 3.0