I've just created 2 projects with Visual Studio 2019 (16.3.3):
Microsoft.EntityFrameworkCore, Version 2.2.4
Repositoryclass to hide
var r = new Repository(@"Server=(localdb)\MsSqlLocalDB; Database=EfCore2Wpf; Trusted_Connection=True;"); DataContext = r.GetItems(); // FileNotFoundException here.
Here's the complete exception:
System.IO.FileNotFoundException: 'Could not load file or assembly "Microsoft.EntityFrameworkCore, Version=184.108.40.206, Culture=neutral, PublicKeyToken=adb9793829ddae60" or one of its dependencies. The specified module could not be found.'
That's right! There's no
(I have some legacy solutions with the same project types and they work. What's wrong here?)
For your information:
1) Including a single .NET Core package like
Microsoft.EntityFrameworkCore.SqlServer cause a Million
<Reference Include="..."><HintPath>..\packages\...dll</HintPath></Reference> entries. That's no option.
2) As far as I remember I had to migrate my legacy WPF projects to pass indirect .NET Core references: https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference. But currently I don't need any NuGet package in my WPF project so there's no
package.config. And without a
package.config file I cannot migrate!
It's a bug and not fixed because nobody cares: https://developercommunity.visualstudio.com/content/problem/769172/a-full-net-project-is-not-in-packagereference-form.html
packages.configfile â†’ "Migrate packages.config to PackageReference..." (you might not need this step if "PackageReference" is your "Default package management format", check Tools â†’ NuGet Package Manager)
Or even faster: Add to your
<ItemGroup> <PackageReference Include="NLog" Version="4.6.7" /> </ItemGroup>
Warning: Use tool support like ReSharper's "Optimize References..." with caution! It would remove the unused reference. :-(