dotnet: cleanup the use Net8.0 as default

This commit is contained in:
Corentin Le Molgat
2025-04-30 15:03:41 +02:00
parent 4ab5969068
commit 3312af9735
13 changed files with 47 additions and 47 deletions

View File

@@ -5,7 +5,7 @@ FROM ortools/cmake:almalinux_swig AS env
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
&& ./dotnet-install.sh -c 8.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

View File

@@ -5,12 +5,12 @@ RUN apk add --no-cache wget icu-libs libintl \
&& mkdir -p /usr/share/dotnet \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
## .Net 6.0
## see: https://dotnet.microsoft.com/download/dotnet-core/6.0
RUN dotnet_sdk_version=6.0.405 \
## .Net 8.0
## see: https://dotnet.microsoft.com/download/dotnet-core/8.0
RUN dotnet_sdk_version=8.0.408 \
&& wget -qO dotnet.tar.gz \
"https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-${dotnet_sdk_version}-linux-musl-x64.tar.gz" \
&& dotnet_sha512='ca98ebc5858339c5ce4164f5f5932a5bf8aae9f13d54adf382a41f5e6d1302df278bd7e218ecc2f651dcf67e705c40c43347cd33956732c6bd88d3b3d2881b84' \
&& dotnet_sha512='0ab0c0d52985bde69b594454b5e1d9e1a6e003159656ee2972058d2960cfb0968dbe4d470d8eb21dcea41ff594976520e189a8e13afc44a419ca08e456df36e1' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \
&& rm dotnet.tar.gz

View File

@@ -7,7 +7,7 @@ RUN apt-get update -qq \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update -qq \
&& apt-get install -yq dotnet-sdk-6.0 \
&& apt-get install -yq dotnet-sdk-8.0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Trigger first run experience by running arbitrary cmd

View File

@@ -1,7 +1,7 @@
FROM ortools/cmake:fedora_swig AS env
RUN dnf -y update \
&& dnf -y install java-11-openjdk java-11-openjdk-devel maven \
&& dnf -y install java-21-openjdk java-21-openjdk-devel maven \
&& dnf clean all
ENV JAVA_HOME=/usr/lib/jvm/java-openjdk

View File

@@ -3,13 +3,13 @@ FROM ortools/cmake:opensuse_swig AS env
# .NET install
# see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-opensuse
RUN zypper refresh \
&& zypper install -y wget tar awk gzip libicu-devel
&& zypper install -y wget tar awk gzip libicu-devel findutils
## .Net 6.0
## .Net 8.0
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
&& ./dotnet-install.sh -c 8.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

View File

@@ -5,7 +5,7 @@ FROM ortools/cmake:rockylinux_swig AS env
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
&& ./dotnet-install.sh -c 8.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<LangVersion>8.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- see https://github.com/dotnet/docs/issues/12237 -->
<RollForward>LatestMajor</RollForward>
<AssemblyName>Google.Sample</AssemblyName>

View File

@@ -41,7 +41,7 @@ USE_SCIP ?= ON
USE_CPLEX ?= OFF
USE_DOTNET_CORE_31 ?= OFF
USE_DOTNET_6 ?= ON
USE_DOTNET_8 ?= ON
BUILD_VENV ?= ON
JOBS ?= 4
@@ -72,7 +72,7 @@ third_party:
-DUSE_SCIP=$(USE_SCIP) \
-DUSE_CPLEX=$(USE_CPLEX) \
-DUSE_DOTNET_CORE_31=$(USE_DOTNET_CORE_31) \
-DUSE_DOTNET_6=$(USE_DOTNET_6) \
-DUSE_DOTNET_8=$(USE_DOTNET_8) \
-DBUILD_VENV=$(BUILD_VENV) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) \

View File

@@ -110,12 +110,12 @@ $(TEMP_DOTNET_DIR)/$1/%/%.csproj: \
> $(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
$(SED) -i -e 's/@DOTNET_SAMPLE_LANG@/9.0/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
ifeq ($(USE_DOTNET_6)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net6.0<\/TargetFrameworks>/' \
ifeq ($(USE_DOTNET_8)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net8.0<\/TargetFrameworks>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
ifeq ($(USE_DOTNET_6),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net6.0<\/TargetFramework>/' \
ifeq ($(USE_DOTNET_8),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net8.0<\/TargetFramework>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>netcoreapp3.1<\/TargetFramework>/' \
@@ -151,9 +151,9 @@ rdotnet_%: \
$(TEMP_DOTNET_DIR)/$1/%/%.csproj \
$(TEMP_DOTNET_DIR)/$1/%/%.cs \
FORCE
ifeq ($(USE_DOTNET_6),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net6.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" run --no-build --framework net6.0 -c Release $(ARGS)
ifeq ($(USE_DOTNET_8),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net8.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" run --no-build --framework net8.0 -c Release $(ARGS)
endif
ifeq ($(USE_DOTNET_CORE_31),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework netcoreapp3.1 -c Release
@@ -184,12 +184,12 @@ $(TEMP_DOTNET_DIR)/$1/%/%.csproj: \
> $(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
$(SED) -i -e 's/@DOTNET_SAMPLE_LANG@/9.0/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
ifeq ($(USE_DOTNET_6)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net6.0<\/TargetFrameworks>/' \
ifeq ($(USE_DOTNET_8)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net8.0<\/TargetFrameworks>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
ifeq ($(USE_DOTNET_6),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net6.0<\/TargetFramework>/' \
ifeq ($(USE_DOTNET_8),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net8.0<\/TargetFramework>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>netcoreapp3.1<\/TargetFramework>/' \
@@ -225,9 +225,9 @@ rdotnet_%: \
$(TEMP_DOTNET_DIR)/$1/%/%.csproj \
$(TEMP_DOTNET_DIR)/$1/%/%.cs \
FORCE
ifeq ($(USE_DOTNET_6),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net6.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" run --no-build --framework net6.0 -c Release $(ARGS)
ifeq ($(USE_DOTNET_8),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net8.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" run --no-build --framework net8.0 -c Release $(ARGS)
endif
ifeq ($(USE_DOTNET_CORE_31),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework netcoreapp3.1 -c Release
@@ -255,12 +255,12 @@ $(TEMP_DOTNET_DIR)/$1/%/%.csproj: \
> $(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
$(SED) -i -e 's/@DOTNET_LANG@/9.0/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
ifeq ($(USE_DOTNET_6)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net6.0<\/TargetFrameworks>/' \
ifeq ($(USE_DOTNET_8)_$(USE_DOTNET_CORE_31),ON_ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net8.0<\/TargetFrameworks>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
ifeq ($(USE_DOTNET_6),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net6.0<\/TargetFramework>/' \
ifeq ($(USE_DOTNET_8),ON)
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>net8.0<\/TargetFramework>/' \
$(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
else
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFramework>netcoreapp3.1<\/TargetFramework>/' \
@@ -296,9 +296,9 @@ rdotnet_%: \
$(TEMP_DOTNET_DIR)/$1/%/%.csproj \
$(TEMP_DOTNET_DIR)/$1/%/%.cs \
FORCE
ifeq ($(USE_DOTNET_6),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net6.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" test --no-build --framework net6.0 -c Release $(ARGS)
ifeq ($(USE_DOTNET_8),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework net8.0 -c Release
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" test --no-build --framework net8.0 -c Release $(ARGS)
endif
ifeq ($(USE_DOTNET_CORE_31),ON)
cd $(TEMP_DOTNET_DIR)$S$1$S$$* && "$(DOTNET_BIN)" build --framework netcoreapp3.1 -c Release
@@ -659,7 +659,7 @@ $(TEMP_DOTNET_DIR)/ortools_examples/examples/dotnet/%.csproj: \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_SAMPLE_LANG@/9.0/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net6.0<\/TargetFrameworks>/' \
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net8.0<\/TargetFrameworks>/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_PROJECT@/$(DOTNET_ORTOOLS_ASSEMBLY_NAME)/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
@@ -694,7 +694,7 @@ $(TEMP_DOTNET_DIR)/ortools_examples/examples/dotnet/%.csproj: \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_SAMPLE_LANG@/9.0/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net6.0<\/TargetFrameworks>/' \
$(SED) -i -e 's/@DOTNET_TFM@/<TargetFrameworks>netcoreapp3.1;net8.0<\/TargetFrameworks>/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
$(SED) -i -e 's/@DOTNET_PROJECT@/$(DOTNET_ORTOOLS_ASSEMBLY_NAME)/' \
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
@@ -741,7 +741,7 @@ endif
######################
.PHONY: nuget_archive # Build .Net "Google.OrTools" Nuget Package
nuget_archive: dotnet | $(TEMP_DOTNET_DIR)
"$(DOTNET_BIN)" publish $(DOTNET_BUILD_ARGS) --no-build --no-dependencies --no-restore -f net6.0 \
"$(DOTNET_BIN)" publish $(DOTNET_BUILD_ARGS) --no-build --no-dependencies --no-restore -f net8.0 \
-o "..$S..$S..$S$(TEMP_DOTNET_DIR)" \
ortools$Sdotnet$S$(DOTNET_ORTOOLS_ASSEMBLY_NAME)$S$(DOTNET_ORTOOLS_ASSEMBLY_NAME).csproj
"$(DOTNET_BIN)" pack -c Release $(NUGET_PACK_ARGS) --no-build \
@@ -750,7 +750,7 @@ nuget_archive: dotnet | $(TEMP_DOTNET_DIR)
.PHONY: nuget_upload # Upload Nuget Package
nuget_upload: nuget_archive
@echo Uploading Nuget package for "netcoreapp3.1;net6.0".
@echo Uploading Nuget package for "netcoreapp3.1;net8.0".
$(warning Not Implemented)
endif # HAS_DOTNET=ON

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Version>1.0.0</Version>
<!-- Nuget Properties -->

View File

@@ -25,11 +25,11 @@ and osx-x64) nuget package using `dotnet` and few `.csproj`.
## Requirement
The library is compiled against `netcoreapp3.1` and `net6.0`, so you'll only
The library is compiled against `netcoreapp3.1` and `net8.0`, so you'll only
need:
* .Net Core 3.1 LTS SDK
* .Net 6.0 LTS SDK
* .Net 8.0 LTS SDK
note: We won't/can't rely on VS 2022 since we want a portable cross-platform
[`dotnet/cli`](https://github.com/dotnet/cli) pipeline.
@@ -230,7 +230,7 @@ defined) should have this layout:
\- Google.OrTools.dll
...
```
note: `{framework}` could be `netcoreapp3.1` or/and `net6.0`
note: `{framework}` could be `netcoreapp3.1` or/and `net8.0`
### Complete Google.OrTools Package
@@ -278,7 +278,7 @@ dotnet pack <build_dir>/dotnet/Google.OrTools
## Examples
The Test projects show examples of building applications with `net6.0`.
The Test projects show examples of building applications with `net8.0`.
The F# example folder shows how to compile against the typical .NET Framework
installed on machine.

View File

@@ -89,7 +89,7 @@ endif #ifeq SOURCE exist
build: $(SOURCE)
"$(DOTNET_BIN)" build examples/$(SOURCE_NAME)/project.csproj
run: build
"$(DOTNET_BIN)" run --no-build --framework net6.0 --project examples/$(SOURCE_NAME)/project.csproj -- $(ARGS)
"$(DOTNET_BIN)" run --no-build --framework net8.0 --project examples/$(SOURCE_NAME)/project.csproj -- $(ARGS)
endif #ifeq SOURCE

View File

@@ -101,12 +101,12 @@ make run SOURCE=examples/dotnet/Vrp/Vrp.cs
```shell
dotnet build examples/dotnet/Vrp/Vrp.csproj
dotnet run --no-build --framework net6.0 --project examples/dotnet/Vrp/Vrp.csproj
dotnet run --no-build --framework net8.0 --project examples/dotnet/Vrp/Vrp.csproj
```
- on Windows:
```shell
dotnet build examples\dotnet\Vrp\Vrp.csproj
dotnet run --no-build --framework net6.0 --project examples\dotnet\Vrp\Vrp.csproj
dotnet run --no-build --framework net8.0 --project examples\dotnet\Vrp\Vrp.csproj
```