|
55 | 55 | <CopilotCliDownloadTimeout Condition="'$(CopilotCliDownloadTimeout)' == ''">600</CopilotCliDownloadTimeout> |
56 | 56 | </PropertyGroup> |
57 | 57 |
|
| 58 | + <!-- Skip automatic download and bundling of the Copilot CLI binary. |
| 59 | + Set CopilotSkipCliDownload to true in your .csproj or Directory.Build.props if you install |
| 60 | + the Copilot CLI separately (e.g., via npm or a package manager) and don't want the SDK |
| 61 | + to download and bundle it. |
| 62 | + |
| 63 | + When skipped, you must provide a valid CLI path at runtime via the CliPath option in |
| 64 | + CopilotClientOptions. If CliPath is not set and the bundled CLI is not found, the SDK |
| 65 | + will throw an InvalidOperationException when starting the client. |
| 66 | + |
| 67 | + <PropertyGroup> |
| 68 | + <CopilotSkipCliDownload>true</CopilotSkipCliDownload> |
| 69 | + </PropertyGroup> --> |
| 70 | + |
58 | 71 | <!-- Download and extract CLI binary --> |
59 | | - <Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(_CopilotPlatform)' != ''"> |
| 72 | + <Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''"> |
60 | 73 | <Error Condition="'$(CopilotCliVersion)' == ''" Text="CopilotCliVersion is not set. The GitHub.Copilot.SDK.props file may be missing from the NuGet package." /> |
61 | 74 |
|
62 | 75 | <!-- Compute paths using version (now available) --> |
|
90 | 103 | </Target> |
91 | 104 |
|
92 | 105 | <!-- Copy CLI binary to output runtimes folder and register for transitive copy --> |
93 | | - <Target Name="_CopyCopilotCliToOutput" AfterTargets="Build" DependsOnTargets="_DownloadCopilotCli" Condition="'$(_CopilotPlatform)' != ''"> |
| 106 | + <Target Name="_CopyCopilotCliToOutput" AfterTargets="Build" DependsOnTargets="_DownloadCopilotCli" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''"> |
94 | 107 | <PropertyGroup> |
95 | 108 | <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli\$(CopilotCliVersion)\$(_CopilotPlatform)</_CopilotCacheDir> |
96 | 109 | <_CopilotCliBinaryPath>$(_CopilotCacheDir)\$(_CopilotBinary)</_CopilotCliBinaryPath> |
|
101 | 114 | </Target> |
102 | 115 |
|
103 | 116 | <!-- Register CLI binary as content so it flows through project references --> |
104 | | - <Target Name="_RegisterCopilotCliForCopy" BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="_DownloadCopilotCli" Condition="'$(_CopilotPlatform)' != ''"> |
| 117 | + <Target Name="_RegisterCopilotCliForCopy" BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="_DownloadCopilotCli" Condition="'$(CopilotSkipCliDownload)' != 'true' And '$(_CopilotPlatform)' != ''"> |
105 | 118 | <PropertyGroup> |
106 | 119 | <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli\$(CopilotCliVersion)\$(_CopilotPlatform)</_CopilotCacheDir> |
107 | 120 | <_CopilotCliBinaryPath>$(_CopilotCacheDir)\$(_CopilotBinary)</_CopilotCliBinaryPath> |
|
0 commit comments