dotnet: Rework C# lang version
* use 9.0 for building library * use 8.0 when building samples
This commit is contained in:
@@ -257,6 +257,14 @@ if(BUILD_DOTNET)
|
||||
option(UNIVERSAL_DOTNET_PACKAGE "Build a .Net multi OS Package" OFF)
|
||||
message(STATUS ".Net: Create multiple os package: ${UNIVERSAL_DOTNET_PACKAGE}")
|
||||
|
||||
# Language Version
|
||||
# see: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
|
||||
set(DOTNET_LANG "9.0" CACHE STRING "Specify the C# language version (default \"9.0\")")
|
||||
message(STATUS ".Net C# language version: ${DOTNET_LANG}")
|
||||
|
||||
set(DOTNET_SAMPLE_LANG "8.0" CACHE STRING "Specify the C# language version for samples (default \"8.0\")")
|
||||
message(STATUS ".Net C# language version: ${DOTNET_SAMPLE_LANG}")
|
||||
|
||||
option(USE_DOTNET_48 "Use .Net Framework 4.8 support" OFF)
|
||||
message(STATUS ".Net: Use .Net Framework 4.8 support: ${USE_DOTNET_48}")
|
||||
|
||||
|
||||
@@ -68,11 +68,6 @@ message(STATUS ".Net runtime project: ${DOTNET_NATIVE_PROJECT}")
|
||||
set(DOTNET_NATIVE_PROJECT_DIR ${PROJECT_BINARY_DIR}/dotnet/${DOTNET_NATIVE_PROJECT})
|
||||
message(STATUS ".Net runtime project build path: ${DOTNET_NATIVE_PROJECT_DIR}")
|
||||
|
||||
# Language Version
|
||||
# see: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
|
||||
set(DOTNET_LANG "9.0")
|
||||
message(STATUS ".Net C# language version: ${DOTNET_LANG}")
|
||||
|
||||
# Targeted Framework Moniker
|
||||
# see: https://docs.microsoft.com/en-us/dotnet/standard/frameworks
|
||||
# see: https://learn.microsoft.com/en-us/dotnet/standard/net-standard
|
||||
|
||||
@@ -108,7 +108,7 @@ $(TEMP_DOTNET_DIR)/$1/%/%.csproj: \
|
||||
$(SED) -e "s/@DOTNET_PACKAGES_DIR@/..\/..\/..\/$(BUILD_DIR)\/dotnet\/packages/" \
|
||||
ortools$Sdotnet$SSample.csproj.in \
|
||||
> $(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_LANG@/9.0/' \
|
||||
$(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>/' \
|
||||
@@ -180,7 +180,7 @@ $(TEMP_DOTNET_DIR)/$1/%/%.csproj: \
|
||||
$(SED) -e "s/@DOTNET_PACKAGES_DIR@/..\/..\/..\/$(BUILD_DIR)\/dotnet\/packages/" \
|
||||
ortools$Sdotnet$SSample.csproj.in \
|
||||
> $(TEMP_DOTNET_DIR)$S$1$S$$*$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_LANG@/9.0/' \
|
||||
$(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>/' \
|
||||
@@ -653,7 +653,7 @@ $(TEMP_DOTNET_DIR)/ortools_examples/examples/dotnet/%.csproj: \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/./' \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_LANG@/9.0/' \
|
||||
$(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>/' \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
@@ -686,7 +686,7 @@ $(TEMP_DOTNET_DIR)/ortools_examples/examples/dotnet/%.csproj: \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/./' \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
$(SED) -i -e 's/@DOTNET_LANG@/9.0/' \
|
||||
$(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>/' \
|
||||
$(TEMP_DOTNET_DIR)$Sortools_examples$Sexamples$Sdotnet$S$$*.csproj
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>@DOTNET_SAMPLE_LANG@</LangVersion>
|
||||
@DOTNET_TFM@
|
||||
<EnableDefaultItems>false</EnableDefaultItems>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
|
||||
Reference in New Issue
Block a user