KC.MSBuild.CopyLocal 1.0.1

dotnet add package KC.MSBuild.CopyLocal --version 1.0.1                
NuGet\Install-Package KC.MSBuild.CopyLocal -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KC.MSBuild.CopyLocal" Version="1.0.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KC.MSBuild.CopyLocal --version 1.0.1                
#r "nuget: KC.MSBuild.CopyLocal, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install KC.MSBuild.CopyLocal as a Cake Addin
#addin nuget:?package=KC.MSBuild.CopyLocal&version=1.0.1

// Install KC.MSBuild.CopyLocal as a Cake Tool
#tool nuget:?package=KC.MSBuild.CopyLocal&version=1.0.1                

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.


<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 ❤️

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

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 397 11/9/2022
1.0.0 439 6/17/2022

Initial release