I have a .NET Standard 2.0 project which uses EF Core via the Nuget package Microsoft.EntityFrameworkCore. Below is the relevant PropertyGroup from the *.csproj file:
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
</ItemGroup>
The solution builds, but at runtime, I get a System.IO.FileNotFoundException:
Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies.
That assembly is not in the build folder (or any subfolders such as the netstandard2.0 subfolder). It is in %userprofile%\.nuget\ ...
I have tried:
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
to the
*.csproj file.Is there some other way of forcing the package to be included in the build folder (like Local Copy)?
Editing the *.csproj files and adding the following to a PropertyGroup seems to have fixed the problem (or at least provided a reasonable workaround):
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>