@@ -149,27 +149,25 @@ DOTNET_BINARY=""
149
149
150
150
if dotnet --version > /dev/null ; then
151
151
DOTNET_BINARY=$( which dotnet)
152
+ RUNTIME_VERSIONS=$( dotnet --list-runtimes | awk ' {print $2}' | sort | uniq)
152
153
fi
153
154
154
155
MAJOR_VERSION_ID=$( echo $( dotnet --version) | cut -d . -f 1)
155
156
PATCH_VERSION_ID=$( echo $( dotnet --version) | cut -d . -f 3)
156
157
157
158
PINNED_SDK_VERSION=" "
158
159
# Oryx needs to be built with .NET 8
159
- if [[ " ${DOTNET_BINARY} " = " " ]] || [[ $MAJOR_VERSION_ID != " 8" ]] || [[ $MAJOR_VERSION_ID = " 8" && ${PATCH_VERSION_ID} -ge " 101 " ]] ; then
160
+ if [[ " ${DOTNET_BINARY} " = " " ]] || [[ $MAJOR_VERSION_ID != " 8" ]] || [[ $MAJOR_VERSION_ID = " 8" && ${PATCH_VERSION_ID} -ne " 202 " ]] ; then
160
161
echo " 'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx."
161
-
162
162
# The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974
163
163
# Pinning it to a working version until the upstream Oryx repo updates the dependency
164
164
# install_dotnet_using_apt
165
- PINNED_SDK_VERSION=" 8.0.101 "
165
+ PINNED_SDK_VERSION=" 8.0.202 "
166
166
install_dotnet_with_script ${PINNED_SDK_VERSION}
167
-
168
167
if ! dotnet --version > /dev/null ; then
169
168
echo " (!) Please install Dotnet before installing Oryx"
170
169
exit 1
171
170
fi
172
-
173
171
fi
174
172
175
173
BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
@@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..."
192
190
cd $GIT_ORYX
193
191
${DOTNET_BINARY} build " $SOLUTION_FILE_NAME " -c Debug
194
192
195
- ${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
196
- ${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildServer/BuildServer.csproj
193
+ ${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj --self-contained true
194
+ ${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX /src/BuildServer/BuildServer.csproj --self-contained true
197
195
198
196
chmod a+x ${BUILD_SCRIPT_GENERATOR} /GenerateBuildScript
199
197
236
234
if [[ " ${PINNED_SDK_VERSION} " != " " ]]; then
237
235
rm -f ${GIT_ORYX} /global.json
238
236
rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION
239
-
240
- # Extract the major, minor version and the first digit of the patch version
241
- MAJOR_MINOR_PATCH1_VERSION=${PINNED_SDK_VERSION% ??}
242
- rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$MAJOR_MINOR_PATCH1_VERSION
243
- rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$MAJOR_MINOR_PATCH1_VERSION
244
- rm -rf /usr/share/dotnet/templates/$MAJOR_MINOR_PATCH1_VERSION
237
+ NEW_RUNTIME_VERSIONS=$( dotnet --list-runtimes | awk ' {print $2}' | sort | uniq)
238
+ if [ -n " ${RUNTIME_VERSIONS:- } " ]; then
239
+ SDK_INSTALLED_RUNTIME=$( echo " $NEW_RUNTIME_VERSIONS " | grep -vxFf <( echo " $RUNTIME_VERSIONS " ) )
240
+ else
241
+ SDK_INSTALLED_RUNTIME=" $NEW_RUNTIME_VERSIONS "
242
+ fi
243
+ rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$SDK_INSTALLED_RUNTIME
244
+ rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$SDK_INSTALLED_RUNTIME
245
+ rm -rf /usr/share/dotnet/templates/$SDK_INSTALLED_RUNTIME
245
246
fi
246
247
247
248
248
249
# Clean up
249
250
rm -rf /var/lib/apt/lists/*
250
251
251
- echo " Done!"
252
+ echo " Done!"
0 commit comments