© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
1 reply
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>
<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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ installing a NuGet package to an existing .NET project
C#CC# / help
15mo ago
NuGet package project references
C#CC# / help
17mo ago
How to use a local project instead of an online nuget package
C#CC# / help
3y ago
❔ Issue with nuget package
C#CC# / help
3y ago