You can add this to a <PropertyGroup>
inside your csproj file to enforce copying NuGet assemblies to the build output:
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
However, note that the build output (bin/Release/netcoreapp*/*
) is not supposed to be portable and distributable, the output of dotnet publish
is. But in your case, copying the assemblies to the build output is probably very useful for testing purposes. But note that you could also use the DependencyContext
api to resolve the DLLs and their locations that are part of the application's dependency graph instead of enumerating a local directory.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…