I'm creating my first project using .Net Core
but I'm having some issues getting two Nuget
packages working probably.
When trying to debug the app, I get the following two errors:
Could not load file or assembly 'GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=0ffbc31322e9d308'. The system cannot find the file specified.
Could not load file or assembly 'GongSolutions.WPF.DragDrop, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0ffbc31322e9d308'. The system cannot find the file specified.
Now, here's what it says for these packages under the solution explorer:
It's showing different versions than what the errors are showing. I searched through every file in my project and the only places I found the wrong versions showing was in my project's .deps.json
file, which shows the following:
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.0": {
"TestProject/1.0.0": {
"dependencies": {
"MvvmLightLibsStd10": "5.4.1.1",
"gong-wpf-dragdrop": "2.1.0",
},
"runtime": {
"TestProject.dll": {}
}
},
"gong-wpf-dragdrop/2.1.0": {
"runtime": {
"lib/netcoreapp3.0/GongSolutions.WPF.DragDrop.dll": {
"assemblyVersion": "2.0.0.0",
"fileVersion": "2.1.0.2"
}
}
},
"MvvmLightLibsStd10/5.4.1.1": {
"runtime": {
"lib/netstandard1.0/GalaSoft.MvvmLight.dll": {
"assemblyVersion": "5.4.1.0",
"fileVersion": "5.4.1.0"
}
}
},
I've tried changing the above to match the right versions, but it didn't change anything.
What else I've tried:
- Uninstalling and Reinstalling the pacakages
- Restarting Visual Studio
I did notice that the wrong packages do exist in other folders under: C:\Users\myname\.nuget\packages
but they don't match the path that visual studio is showing me for the actual .dlls
I'm using.
Some notes that might be useful:
The entire solution contains two projects: a WPF Windows Application
which contains a single Window
and a WPF Class Library
, which has a UserControl
hosted inside the wpf application project.
The Class Library
is what contains the nuget packages.
Both projects are targeting .NET Core 3.0
.
Update: I've tried putting the following inside a <PropertyGroup>
tag in both my .csproj
files:
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
None of them worked.