This is a small Nuget package, that helps with copying dependencies to the build output dir, when msbuild doesn't.
You should try the build-in <CopyLocalLockFileAssemblies>
property (see) first, but if you need more control over the result, you'll need this package.
Install this package using Package Manager Console:
Install-Package KC.MSBuild.CopyLocal
Or a terminal:
dotnet add package KC.MSBuild.CopyLocal
Once installed this package will copy all runtime assemblies of your referenced <PagckageReference>
dependencies to the build output dir. This is helpfull if you're developing a class lib
project and need all used assemblies inside the output dir.
You can decide which <PackageReference>
dependencies you want to be copied to the build output dir. By setting the PrivateAssets="All"
attribute, you can disable the local copy of a PackageReference and all transitiv dependencies.
<!-- This will not copy Serilog.dll to the build output dir -->
<PackageReference Include="Serilog" Version="11.0.0" PrivateAssets="All" />
- Visual Studio 2022 (Version 17.2)
- Visual Studio Code & .net6 SDK (Version 6.0.300)
This Nuget was only tested with these versions of msbuild. It may or may not work with older or newer versions.
- Beside runtime assemblies PackageReferences can include native or resource files. These are not covered yet.
If you like my work, please support this project!
Donate via PayPal
or become a Sponsor on GitHub