✅ 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>
<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" />
<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?
1 Reply
Turn2Jesus2
Turn2Jesus2OP3d ago
NuGet PackageReference in project files
Details on NuGet PackageReference in project files as supported by NuGet 4.0+ and VS2017 and .NET Core 2.0

Did you find this page helpful?