And there lies your problem. Are you hand coding your .CSPROJ file? Are you drag/dropping and replacing files within an existing project?
Create a brand new project and be sure to select "WPF App" or "WPF App (.NET Framework)" in Visual Studio as the project type. That should give you a nice starting point which will generate the "MainWindow.g.i.cs" file which contains the InitializeComponent()
method that in automatically generated and maintained as you use the WPF window editor.
Get that compiling first. And then incrementally add stuff to your project. Be sure to take advantage of source control and commit versions as you go along so that you can fallback to previously working version.
I have a small suspicion that part of the issue maybe also that error you are showing in your screenshot regarding "System.Reflection.MetadataLoadContext". It feels like your .NET (Core) or Visual Studio installation maybe corrupted. Try doing a repair on both. The code that the compiler generates for that .g.i.cs file needs information from the metadata. If the metadata can't be loaded, then it's likely the generated code cannot be generated.