Description
When packaging a .NET application as a dotnet tool (PackAsTool=true) that depends on GitHub.Copilot.SDK, the native Copilot CLI binary is not included in the .nupkg tool layout. At runtime, the tool fails with:
Copilot runtime not found at '...tools/net10.0/win-x64/runtimes/win-x64/native/copilot.exe'.
Ensure the SDK NuGet package was restored correctly or provide an explicit RuntimeConnection.ForStdio(path: ...) / RuntimeConnection.ForTcp(path: ...).
Root Cause
The SDK's build targets use ContentWithTargetPath with CopyToOutputDirectory to copy the CLI binary to bin/runtimes/{rid}/native/. However, PackAsTool does not include ContentWithTargetPath items in the tool package layout. The binary ends up in the build output but not in the .nupkg.
Additionally, when building on a Linux CI agent, the SDK downloads only the Linux binary. Even with RuntimeIdentifiers=win-x64;linux-x64, the per-RID builds download the correct platform binary, but it still doesn't make it into the tool package.
Steps to Reproduce
- Create a project with
PackAsTool=true and GitHub.Copilot.SDK reference
- Run
dotnet pack on a Linux agent
- Install the tool on Windows via
dotnet tool install or dotnet dpx
- Run the tool -> crash with "Copilot runtime not found"
Expected Behavior
The Copilot CLI binaries for all target RIDs should be included in the NuGet tool package, similar to how packages like libgit2sharp and SkiaSharp ship native binaries under runtimes/{rid}/native/ in the package itself.
Suggested Fix
Ship the Copilot CLI binaries as proper runtimes/{rid}/native/ assets in the GitHub.Copilot.SDK NuGet package (all supported platforms), instead of downloading them at build time. This would make PackAsTool, PublishSingleFile, and cross-platform CI packaging all work correctly.
Environment
- GitHub.Copilot.SDK: 1.0.8-preview.0
- .NET SDK: 10.0.302
- OS: Linux (CI build agent) / Windows (runtime)
Description
When packaging a .NET application as a dotnet tool (
PackAsTool=true) that depends onGitHub.Copilot.SDK, the native Copilot CLI binary is not included in the.nupkgtool layout. At runtime, the tool fails with:Root Cause
The SDK's build targets use
ContentWithTargetPathwithCopyToOutputDirectoryto copy the CLI binary tobin/runtimes/{rid}/native/. However,PackAsTooldoes not includeContentWithTargetPathitems in the tool package layout. The binary ends up in the build output but not in the.nupkg.Additionally, when building on a Linux CI agent, the SDK downloads only the Linux binary. Even with
RuntimeIdentifiers=win-x64;linux-x64, the per-RID builds download the correct platform binary, but it still doesn't make it into the tool package.Steps to Reproduce
PackAsTool=trueandGitHub.Copilot.SDKreferencedotnet packon a Linux agentdotnet tool installordotnet dpxExpected Behavior
The Copilot CLI binaries for all target RIDs should be included in the NuGet tool package, similar to how packages like
libgit2sharpandSkiaSharpship native binaries underruntimes/{rid}/native/in the package itself.Suggested Fix
Ship the Copilot CLI binaries as proper
runtimes/{rid}/native/assets in theGitHub.Copilot.SDKNuGet package (all supported platforms), instead of downloading them at build time. This would makePackAsTool,PublishSingleFile, and cross-platform CI packaging all work correctly.Environment