title: CefSharp.WPF won't run as a self-contained file .NET Core
body: <p>I was able to create and run a browser in a WPF window using CefSharp (84.4.10.0). Everything runs fine in debug/release mode. If I try to publish as a self-contained win-x64 executable. The app crashes with the following exception:</p>
  <pre><code>Application: App.exe
  CoreCLR Version: 4.700.20.47201
  .NET Core Version: 3.1.9
  Description: The process was terminated due to an unhandled exception.
  Exception Info: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'CefSharp.Wpf.ChromiumWebBrowser' that matches the specified binding constraints threw an exception.
  ---&gt; System.TypeInitializationException: The type initializer for 'CefSharp.Cef' threw an exception.
  ---&gt; System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
  File name: 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
  at CefSharp.Cef..cctor()
  
  --- End of inner exception stack trace ---
  at CefSharp.Cef.get_IsInitialized()
  at CefSharp.Wpf.ChromiumWebBrowser.NoInliningConstructor()
  at CefSharp.Wpf.ChromiumWebBrowser..ctor()
  --- End of inner exception stack trace ---
  at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
  at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
  at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
  at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
  at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
  at RssFeedTicker.RssFeedWindow.InitializeComponent()
  at RssFeedTicker.MainWindow.Button_Click(Object sender, RoutedEventArgs e)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
  at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
  at System.Windows.Controls.Primitives.ButtonBase.OnClick()
  at System.Windows.Controls.Button.OnClick()
  at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
  at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
  at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
  at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
  at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
  at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
  at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
  at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
  at System.Windows.Input.InputManager.ProcessStagingArea()
  at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
  at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
  at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
  at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
  at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
  at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
  at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
  at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
  at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
  at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)
  at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
  at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
  at System.Windows.Threading.Dispatcher.Run()
  at System.Windows.Application.RunDispatcher(Object ignore)
  at System.Windows.Application.RunInternal(Window window)
  at System.Windows.Application.Run()
  at App.App.Main()
  </code></pre>
  <p>I've also copied these files to the same directory as the output file:</p>
  <pre><code>cef.pak
  CefSharp.BrowserSubprocess.Core.dll
  CefSharp.BrowserSubprocess.exe
  CefSharp.Core.dll
  CefSharp.dll
  CefSharp.WinForms.dll
  cef_100_percent.pak
  cef_200_percent.pak
  cef_extensions.pak
  d3dcompiler_43.dll
  d3dcompiler_47.dll
  devtools_resources.pak
  HAP.dll
  icudtl.dat
  libcef.dll
  libEGL.dll
  libGLESv2.dll
  loc.txt
  natives_blob.bin
  snapshot_blob.bin
  widevinecdmadapter.dll
  </code></pre>
  <p>The app does not run as a self-contained exe.</p>