Skip to content

Commit 273c425

Browse files
nayanshahclaudeCopilot
authored
Allow custom npm registry URL for downloading Copilot from dotnet SDK (#463)
* Allow custom npm registry URL for .NET SDK Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Update dotnet/src/build/GitHub.Copilot.SDK.targets Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update dotnet/src/build/GitHub.Copilot.SDK.targets Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f460b5d commit 273c425

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
<_CopilotBinary Condition="'$(_CopilotBinary)' == ''">copilot</_CopilotBinary>
3838
</PropertyGroup>
3939

40+
<!-- Allow customization of the npm registry URL used to download the Copilot CLI.
41+
This is primarily for organizations using private or mirrored npm registries.
42+
Set CopilotNpmRegistryUrl in your .csproj or Directory.Build.props, for example:
43+
<PropertyGroup>
44+
<CopilotNpmRegistryUrl>https://your-private-registry.example.com</CopilotNpmRegistryUrl>
45+
</PropertyGroup>
46+
If not set, this defaults to https://registry.npmjs.org. -->
47+
<PropertyGroup>
48+
<CopilotNpmRegistryUrl Condition="'$(CopilotNpmRegistryUrl)' == ''">https://registry.npmjs.org</CopilotNpmRegistryUrl>
49+
</PropertyGroup>
50+
4051
<!-- Download and extract CLI binary -->
4152
<Target Name="_DownloadCopilotCli" BeforeTargets="BeforeBuild" Condition="'$(_CopilotPlatform)' != ''">
4253
<Error Condition="'$(CopilotCliVersion)' == ''" Text="CopilotCliVersion is not set. The GitHub.Copilot.SDK.props file may be missing from the NuGet package." />
@@ -46,7 +57,8 @@
4657
<_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli\$(CopilotCliVersion)\$(_CopilotPlatform)</_CopilotCacheDir>
4758
<_CopilotCliBinaryPath>$(_CopilotCacheDir)\$(_CopilotBinary)</_CopilotCliBinaryPath>
4859
<_CopilotArchivePath>$(_CopilotCacheDir)\copilot.tgz</_CopilotArchivePath>
49-
<_CopilotDownloadUrl>https://registry.npmjs.org/@github/copilot-$(_CopilotPlatform)/-/copilot-$(_CopilotPlatform)-$(CopilotCliVersion).tgz</_CopilotDownloadUrl>
60+
<_CopilotNormalizedRegistryUrl>$([System.String]::Copy('$(CopilotNpmRegistryUrl)').TrimEnd('/'))</_CopilotNormalizedRegistryUrl>
61+
<_CopilotDownloadUrl>$(_CopilotNormalizedRegistryUrl)/@github/copilot-$(_CopilotPlatform)/-/copilot-$(_CopilotPlatform)-$(CopilotCliVersion).tgz</_CopilotDownloadUrl>
5062
</PropertyGroup>
5163

5264
<!-- Delete archive if binary missing (handles partial/corrupted downloads) -->

0 commit comments

Comments
 (0)