I'm building a .NET Framework 4.8 class library in a Docker file. The class library is referencing Entity Framework 6.4.4. My solution builds ok in Visual Studio 2019 on my laptop.
The Docker file:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
WORKDIR C:\src\lib\MyClassLib
COPY src\lib\MyClassLib\ .
RUN nuget restore packages.config -PackagesDirectory ..\..\packages
RUN msbuild MyClassLib.csproj
The NuGet restore step seems to go well:
Added package 'EntityFramework.6.4.4' to folder 'C:\packages'
But in the next step that does the build, the EntityFramework reference could not be found.
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\..\packages\EntityFramework.6.4.4\build\EntityFramework.props.
Based on the folder structure, the relative path to the packages folder in .csproj should end up in C:\packages. The file that it is complaining about, is actually present. I inspected it using RUN dir C:\packages\EntityFramework.6.4.4\build in the Docker file.
How can I fix this?