Skip to content

Commit c7c5372

Browse files
committed
Install the .NET Core 2.1 runtime so we can execute tests against it.
1 parent f4f629e commit c7c5372

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

DotnetExtraRuntimeVersion.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1.12

init-tools.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export __BUILDTOOLS_USE_CSPROJ=true
1212
__BUILD_TOOLS_PACKAGE_VERSION=$(cat "$__scriptpath/BuildToolsVersion.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
1313

1414
DotNetCliFileName="DotnetCLIVersion.txt"
15+
DotNetExtraRuntimeFileName="DotnetExtraRuntimeVersion.txt"
1516

1617
for i do
1718
if [[ "$i" == *"netcoreapp3_0"* ]]; then
@@ -20,6 +21,7 @@ for i do
2021
done
2122

2223
__DOTNET_TOOLS_VERSION=$(cat "$__scriptpath/$DotNetCliFileName" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
24+
__DOTNET_RUNTIME_VERSION=$(cat "$__scriptpath/$DotNetExtraRuntimeFileName" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
2325
__BUILD_TOOLS_PATH="$__PACKAGES_DIR/microsoft.dotnet.buildtools/$__BUILD_TOOLS_PACKAGE_VERSION/lib"
2426
__INIT_TOOLS_RESTORE_PROJECT="$__scriptpath/init-tools.msbuild"
2527
__BUILD_TOOLS_SEMAPHORE="$__TOOLRUNTIME_DIR/$__BUILD_TOOLS_PACKAGE_VERSION/init-tools.complete"
@@ -128,10 +130,11 @@ if [ ! -e "$__DOTNET_PATH" ]; then
128130
esac
129131
__PKG_RID=$__PKG_RID-$__PKG_ARCH
130132
__DOTNET_PKG=dotnet-sdk-${__DOTNET_TOOLS_VERSION}-$__PKG_RID
133+
__DOTNET_EXTRA_RUNTIME_PKG=dotnet-runtime-${__DOTNET_RUNTIME_VERSION}-$__PKG_RID
131134
fi
132135
mkdir -p "$__DOTNET_PATH"
133136

134-
echo "Installing dotnet cli..."
137+
echo "Installing dotnet cli ${__DOTNET_TOOLS_VERSION}..."
135138
__DOTNET_LOCATION="https://dotnetcli.azureedge.net/dotnet/Sdk/${__DOTNET_TOOLS_VERSION}/${__DOTNET_PKG}.tar.gz"
136139

137140
install_dotnet_cli() {
@@ -153,6 +156,28 @@ if [ ! -e "$__DOTNET_PATH" ]; then
153156
}
154157
execute_with_retry install_dotnet_cli >> "$__init_tools_log" 2>&1
155158

159+
echo "Installing dotnet runtime ${__DOTNET_RUNTIME_VERSION}..."
160+
__DOTNET_EXTRA_RUNTIME_LOCATION="https://dotnetcli.azureedge.net/dotnet/Runtime/${__DOTNET_RUNTIME_VERSION}/${__DOTNET_EXTRA_RUNTIME_PKG}.tar.gz"
161+
162+
install_dotnet_extra_runtime() {
163+
if [[ -z "${DotNetExtraRuntimeTarPath-}" ]]; then
164+
echo "Installing '${__DOTNET_EXTRA_RUNTIME_LOCATION}' to '$__DOTNET_PATH/dotnet.extra.runtime.tar'"
165+
rm -rf -- "$__DOTNET_PATH/*"
166+
# curl has HTTPS CA trust-issues less often than wget, so lets try that first.
167+
if command -v curl > /dev/null; then
168+
curl --retry 10 -sSL --create-dirs -o $__DOTNET_PATH/dotnet.extra.runtime.tar ${__DOTNET_EXTRA_RUNTIME_LOCATION}
169+
else
170+
wget -q -O $__DOTNET_PATH/dotnet.extra.runtime.tar ${__DOTNET_EXTRA_RUNTIME_LOCATION}
171+
fi
172+
else
173+
echo "Copying '$DotNetExtraRuntimeTarPath' to '$__DOTNET_PATH/dotnet.extra.runtime.tar'"
174+
cp $DotNetExtraRuntimeTarPath $__DOTNET_PATH/dotnet.extra.runtime.tar
175+
fi
176+
cd "$__DOTNET_PATH"
177+
tar -xf "$__DOTNET_PATH/dotnet.extra.runtime.tar"
178+
}
179+
execute_with_retry install_dotnet_extra_runtime >> "$__init_tools_log" 2>&1
180+
156181
cd "$__scriptpath"
157182
fi
158183

0 commit comments

Comments
 (0)