Skip to content

Update Install Script to enable Self-Contained Download #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions helpers/installcredprovider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ param(
# install the .NET 6 cred provider instead of NetCore3.1
[switch]$InstallNet6 = $true,
# install the .NET 8 cred provider instead of NetCore3.1
[switch]$InstallNet8
[switch]$InstallNet8,
# install the self-contained cred provider for the specified platform.
[string]$Platform
)

$script:ErrorActionPreference='Stop'
Expand Down Expand Up @@ -103,6 +105,11 @@ if (!$releaseId) {
$releaseUrl = [System.IO.Path]::Combine($releaseUrlBase, $releaseId)
$releaseUrl = $releaseUrl.Replace("\","/")

$releaseRIdPart = ""
if (![string]::IsNullOrEmpty($Platform)) {
$releaseRIdPart = $Platform + "."
}

$zipFile = "Microsoft.NetCore3.NuGet.CredentialProvider.zip"
if ($Version.StartsWith("0.")) {
# versions lower than 1.0.0 installed NetCore2 zip
Expand All @@ -112,7 +119,7 @@ if ($InstallNet6 -eq $True) {
$zipFile = "Microsoft.Net6.NuGet.CredentialProvider.zip"
}
if ($InstallNet8 -eq $True) {
$zipFile = "Microsoft.Net8.NuGet.CredentialProvider.zip"
$zipFile = "Microsoft.Net8." + $releaseRIdPart + "NuGet.CredentialProvider.zip"
}
if ($AddNetfx -eq $True) {
$zipFile = "Microsoft.NuGet.CredentialProvider.zip"
Expand Down
11 changes: 9 additions & 2 deletions helpers/installcredprovider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ if [ -z ${USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER} ] || [ ${USE_NET6_ARTIFACTS_CR
esac
# Don't attempt to install .NET 8 without a set variable.
elif [ ! -z ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} ] && [ ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} != "false" ]; then
FILE="Microsoft.Net8.NuGet.CredentialProvider.tar.gz"
# Self-contained versions are available in latest versions of the .NET 8 credprovider.
# To install a release with a specific runtime version set the `USE_RID_ARTIFACTS_CREDENTIAL_PROVIDER` enviornment variable.
# Otherwise default to the full zip file.
RID=""
if [ ! -z ${USE_RID_ARTIFACTS_CREDENTIAL_PROVIDER} ]; then
RID=".${USE_RID_ARTIFACTS_CREDENTIAL_PROVIDER}"
fi
FILE="Microsoft.Net8$RID.NuGet.CredentialProvider.tar.gz"

# throw if version starts < 1.3.0. (net8 not supported)
case ${AZURE_ARTIFACTS_CREDENTIAL_PROVIDER_VERSION} in
Expand Down Expand Up @@ -68,4 +75,4 @@ if ! curl -H "Accept: application/octet-stream" \
exit 1
fi

echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"
echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"