Dotnet restores and installs nuget packages which are then not found during the build process

For a project which used to be built normally with visual studio,

RUN dotnet build “sln file” --configuration Release -v normal --packages “nugetpkg” --configfile “Nuget.config”

gives the following output:

Installed NLog 5.1.4 from with content hash Ki0XThITEd//RrQ21yi1HB/Uid4pzTRE5YLvEpk91d0vDXp3OPtVCvWgrYsqqcpTwiipFSOLSsU1RblaexrFiA==.

and then in another place:

2>C:\src\ops-tools\Engel.Tools.Aspose\Engel.Tools.Aspose\ComponentBase.cs(1,7): error CS0246: The type or namespace name ‘NLog’ could not be found (are you missing a using directive or an assembly reference?) [C:\src\ops-tools\Engel.Tools.Aspose\Engel.Tools.Aspose\Engel.Tools.Aspose.csproj]

which leads to a failed build. Do you have any advice how to correct this?

Thank you in advance!