C#C
C#10mo ago
Turn2Jesus2

✅ How to copy an EXE from a NuGet package in SDK-style project with PackageReference?

In the old msbuild format, I was including a nuget package that distributed an EXE file among other things. In the Content include, we referenced back to the exe using relative pathing ..\packages\my.exe and used Link to place it in the build output. How do I do that in PackageReference world?

This is my old msbuild-style project content include where it worked

It copied the EXE file to the bin directory, where I want it
<Content Include="..\packages\abc.1.2.3\tools\abc\abc.exe">
  <Link>abc.exe</Link>
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>


packages.config

<package id="abc" version="1.2.3" targetFramework="net461" />


However, now, it's in SDK-style format and I can't figure out how to include it.

How should I solve this?
Was this page helpful?