Skip to content

Commit df23ff4

Browse files
Add CopilotSkipCliDownload option to .NET SDK (#494)
Add MSBuild property CopilotSkipCliDownload that when set to true skips automatic download and bundling of the Copilot CLI binary. This is useful for users who install the CLI separately (e.g., via npm or a package manager) and want to avoid the build-time download. When skipped, users must ensure COPILOT_CLI_PATH or the CliPath option points to a valid CLI installation at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ed51ab8 commit df23ff4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dotnet/src/build/GitHub.Copilot.SDK.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
<CopilotCliDownloadTimeout Condition="'$(CopilotCliDownloadTimeout)' == ''">600</CopilotCliDownloadTimeout>
5656
</PropertyGroup>
5757

58-
<!-- Download and extract CLI binary -->
59-
<Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(_CopilotPlatform)' != ''">
58+
<!-- Download and extract CLI binary. Set CopilotSkipCliDownload=true to skip if you install the CLI separately. -->
59+
<Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''">
6060
<Error Condition="'$(CopilotCliVersion)' == ''" Text="CopilotCliVersion is not set. The GitHub.Copilot.SDK.props file may be missing from the NuGet package." />
6161

6262
<!-- Compute paths using version (now available) -->
@@ -90,7 +90,7 @@
9090
</Target>
9191

9292
<!-- Copy CLI binary to output runtimes folder and register for transitive copy -->
93-
<Target Name="_CopyCopilotCliToOutput" AfterTargets="Build" DependsOnTargets="_DownloadCopilotCli" Condition="'$(_CopilotPlatform)' != ''">
93+
<Target Name="_CopyCopilotCliToOutput" AfterTargets="Build" DependsOnTargets="_DownloadCopilotCli" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''">
9494
<PropertyGroup>
9595
<_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli\$(CopilotCliVersion)\$(_CopilotPlatform)</_CopilotCacheDir>
9696
<_CopilotCliBinaryPath>$(_CopilotCacheDir)\$(_CopilotBinary)</_CopilotCliBinaryPath>
@@ -101,7 +101,7 @@
101101
</Target>
102102

103103
<!-- Register CLI binary as content so it flows through project references -->
104-
<Target Name="_RegisterCopilotCliForCopy" BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="_DownloadCopilotCli" Condition="'$(_CopilotPlatform)' != ''">
104+
<Target Name="_RegisterCopilotCliForCopy" BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="_DownloadCopilotCli" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''">
105105
<PropertyGroup>
106106
<_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli\$(CopilotCliVersion)\$(_CopilotPlatform)</_CopilotCacheDir>
107107
<_CopilotCliBinaryPath>$(_CopilotCacheDir)\$(_CopilotBinary)</_CopilotCliBinaryPath>

0 commit comments

Comments
 (0)