I am trying to create an updater window for my Wpf app that compares the local dll’s & pdb’s with what is saved on my github. My updater window is a User Control Library (which allows me to reference the updater’s dll in the main app). My issue is that while everything works well normally, the minute it calls InitializeComponent() inside UserControl1 (the default function of a User Control Library) it breaks with this error message:
System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime, Version=
4.2.2.0
, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
I’m not entirely sure where to look or how to fix it, and I was wondering if someone could help direct me on trying to solve this issue?
Wpf app uses .NET Framework 4.6.1 (net461), while PackageUpdate targets the netcoreapp3.1 framework.
Wpf’s App.xaml.cs:
using PackageUpdate;...
public partial class App : System.Windows.Application
{
private void App_Startup(object sender, StartupEventArgs e)
{
Window window = new Window { Content = new UserControl1() };
window.Show
();
}
}
PackageUpdate’s MainWindow.xaml.cs:
namespace PackageUpdate
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent(); //this is where it breaks
}
}
}
I would make your wpf app core as well. Referencing core from full framework is the most likely cause. The other thing is check the binding redirects in app.config to make sure the versions are right.
C# devs
null reference exceptions