Skip to content

A small Nuget package, that helps with copying dependencies to the build output

License

Notifications You must be signed in to change notification settings

KhaosCoders/MSBuild.CopyLocal

Repository files navigation

KC.MSBuild.CopyLocal

This is a small Nuget package, that helps with copying dependencies to the build output dir, when msbuild doesn't.

Build Test codecov NuGet

You should try the build-in <CopyLocalLockFileAssemblies> property (see) first, but if you need more control over the result, you'll need this package.

Installation

Install this package using Package Manager Console:

Install-Package KC.MSBuild.CopyLocal

Or a terminal:

dotnet add package KC.MSBuild.CopyLocal

Output

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.

Selective copy

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" />

Tested with

  • 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.

Known Issues

  • Beside runtime assemblies PackageReferences can include native or resource files. These are not covered yet.

Support this <3

If you like my work, please support this project!
Donate via PayPal or become a Sponsor on GitHub

About

A small Nuget package, that helps with copying dependencies to the build output

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages