Miguel Domingues
Miguel Domingues

Reputation: 440

How to configure a .NET Core project to copy a specified NuGet reference to the build output?

A have a .NET Core project and i want to copy a specified NuGet reference (assembly.dll) to the build output because i'm using a dependency injection component that searches de bin folder for the types.

I know that i could use this, but it copies all the nugets when I only want a specific nuget package to be copied:

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

Upvotes: 0

Views: 180

Answers (1)

Troy Turley
Troy Turley

Reputation: 745

Assuming you're using Visual Studio... Project->Properties->Build Events

"Put this in the Post-build event command line:" box

copy "$(SolutionDir)assembly.dll" "$(TargetDir)"

Or add this to your project file:

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="copy &quot;$(SolutionDir)assembly.dll&quot; &quot;$(TargetDir)&quot;" />
  </Target>

Upvotes: 1

Related Questions