From the docs you linked:
ExcludeAssets:
These assets will not be consumed
runtime:
Contents of the lib and runtimes folder and controls whether these assemblies will be copied out to the build output directory
so, ExcludeAssets="runtime"
explcitly means "don't copy dlls". I'd suggest removing any usage of ExcludeAssets
and PrivateAssets
and let NuGet use its defaults. If you don't want NuGet's default behaviour, then start using these keywords.
However, there's another thing going on as well. You said your test project is a non-SDK style project. It's possible to target the .NET Framework from an SDK style project, but unfortunatly Visual Studio's templates call them ".NET Core" or '.NET Standard", so people incorrectly assume they can't target .NET Framework. Anyway, while packages are transitive for projects using PackageReference, SDK style projects are always PackageReference, even when there are no packages referenced. However, non-SDK style projects are not. You either need to have one PackageReference in the project or excplicitly set the MSBuild property RestoreProjectStyle
to PackageReference
. Otherwise NuGet will look for a packages.config file and if that's not found, NuGet considers the project to not use NuGet at all.
Although, it occurs to me now that your test project almost certainly contains references to packages, at least the test framework itself. If those references are via packages.config, this is a known incompatibility. packages.config projects that have project references to PackageReference projects do not completely work properly. There's better compatibility the other way around, or alternatively migrate the test project to PackageReference as well. Honestly I'd strongly suggest migrating all projects that you can to SDK style, even if you keep targeting the .NET Framework. It's the future of .NET and the tools work better. Fewer of these little gotchas.
If the test project is using PackageReference already, then the problem is just that the ExcludeAssets="runtime"
is being applied transitively, and by removing it from your referenced project, it will automatically flow to the test project.