完整的.NET参考.NET标准类库:FileNotFoundException

问题描述 投票:0回答:1

我刚刚使用Visual Studio 2019(16.3.3)创建了2个项目:

  1. 类库(netstandard2.0
    • + Microsoft.EntityFrameworkCore,版本2.2.4
    • +自定义Repository类以隐藏DbContext
  2. WPF项目(v4.7.1
    • +对上面的类库的引用
    • +一些使用Repository的代码:
var r = new Repository(@"Server=(localdb)\MsSqlLocalDB; Database=EfCore2Wpf; Trusted_Connection=True;");
DataContext = r.GetItems(); // FileNotFoundException here.

这里是完整的例外:

System.IO.FileNotFoundException:'无法加载文件或程序集“ Microsoft.EntityFrameworkCore,版本= 2.2.4.0,区域性=中性,PublicKeyToken = adb9793829ddae60”或其依赖项之一。找不到指定的模块。'

是的! Microsoft.EntityFrameworkCore.dll文件夹中没有\WpfApp\bin\Debug但是为什么?

((我有一些具有相同项目类型的旧式解决方案,它们可以工作。这里出了什么问题?)


供参考:

1]包含单个[.C0]之类的.NET Core软件包将导致数百万Microsoft.EntityFrameworkCore.SqlServer项。 这是没有选择。

2)据我记得,我不得不迁移旧的WPF项目以传递间接的.NET Core参考:<Reference Include="..."><HintPath>..\packages\...dll</HintPath></Reference>。但是目前,我在WPF项目中不需要任何NuGet包,因此没有https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference。并且没有package.config文件我无法迁移

c# .net wpf entity-framework-core .net-standard
1个回答
0
投票

可能是一个错误,没有得到修复,因为没有引用NuGet软件包的情况很少见。我还是提出了一个问题:package.config

© www.soinside.com 2019 - 2024. All rights reserved.