@@ -149,27 +149,25 @@ DOTNET_BINARY=""
149149
150150if dotnet --version > /dev/null ; then
151151 DOTNET_BINARY=$( which dotnet)
152+ RUNTIME_VERSIONS=$( dotnet --list-runtimes | awk ' {print $2}' | sort | uniq)
152153fi
153154
154155MAJOR_VERSION_ID=$( echo $( dotnet --version) | cut -d . -f 1)
155156PATCH_VERSION_ID=$( echo $( dotnet --version) | cut -d . -f 3)
156157
157158PINNED_SDK_VERSION=" "
158159# 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
160161 echo " 'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx."
161-
162162 # The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974
163163 # Pinning it to a working version until the upstream Oryx repo updates the dependency
164164 # install_dotnet_using_apt
165- PINNED_SDK_VERSION=" 8.0.101 "
165+ PINNED_SDK_VERSION=" 8.0.202 "
166166 install_dotnet_with_script ${PINNED_SDK_VERSION}
167-
168167 if ! dotnet --version > /dev/null ; then
169168 echo " (!) Please install Dotnet before installing Oryx"
170169 exit 1
171170 fi
172-
173171fi
174172
175173BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
@@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..."
192190cd $GIT_ORYX
193191${DOTNET_BINARY} build " $SOLUTION_FILE_NAME " -c Debug
194192
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
197195
198196chmod a+x ${BUILD_SCRIPT_GENERATOR} /GenerateBuildScript
199197
236234if [[ " ${PINNED_SDK_VERSION} " != " " ]]; then
237235 rm -f ${GIT_ORYX} /global.json
238236 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
245246fi
246247
247248
248249# Clean up
249250rm -rf /var/lib/apt/lists/*
250251
251- echo " Done!"
252+ echo " Done!"
0 commit comments