0

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>
2

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

That would work, though its not the perfect solution because I have to update the postbuild cmd every time the nuget is updated to a new version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.