Browse Source

Upgraded project to .NET 7 AOT and unixODBC 2.3.11 (#7744)

* Upgrade to .NET 7 and unixODBC 2.3.11

* Improved AOT .NET 7 parameters

* Corrected project files

Co-authored-by: LLT21 <[email protected]>
LLT21 2 years ago
parent
commit
d1bc55f274

+ 2 - 2
frameworks/CSharp/appmpower/appmpower-ado-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 RUN apt-get update
 RUN apt-get update
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 
 
@@ -8,7 +8,7 @@ RUN mv ./appMpower.ado ./appMpower.csproj
 RUN dotnet publish -c Release -o out -r linux-x64
 RUN dotnet publish -c Release -o out -r linux-x64
 
 
 # Construct the actual image that will run
 # Construct the actual image that will run
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
 RUN apt-get update
 RUN apt-get update
 
 
 WORKDIR /app
 WORKDIR /app

+ 15 - 8
frameworks/CSharp/appmpower/appmpower-odbc-my.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 RUN apt-get update
 RUN apt-get update
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
 RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
@@ -7,10 +7,13 @@ RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
 
 
 WORKDIR /odbc
 WORKDIR /odbc
 
 
-RUN curl -L -o unixODBC-2.3.9.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz
-RUN tar -xvf unixODBC-2.3.9.tar.gz
+#RUN curl -L -o unixODBC-2.3.9.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz
+RUN curl -L -o unixODBC-2.3.11.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.11.tar.gz
+#RUN tar -xvf unixODBC-2.3.9.tar.gz
+RUN tar -xvf unixODBC-2.3.11.tar.gz
 
 
-WORKDIR /odbc/unixODBC-2.3.9
+#WORKDIR /odbc/unixODBC-2.3.9
+WORKDIR /odbc/unixODBC-2.3.11
 RUN ./configure --prefix=/usr/local/unixODBC
 RUN ./configure --prefix=/usr/local/unixODBC
 RUN make
 RUN make
 RUN make install
 RUN make install
@@ -22,7 +25,7 @@ COPY src .
 RUN dotnet publish -c Release -o out -r linux-x64 /p:Database=mysql
 RUN dotnet publish -c Release -o out -r linux-x64 /p:Database=mysql
 
 
 # Construct the actual image that will run
 # Construct the actual image that will run
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
 
 
 RUN apt-get update
 RUN apt-get update
 # The following installs standard versions unixodbc 2.3.6 and pgsqlodbc 11
 # The following installs standard versions unixodbc 2.3.6 and pgsqlodbc 11
@@ -32,9 +35,13 @@ RUN apt-get install -y unixodbc wget curl
 
 
 WORKDIR /odbc
 WORKDIR /odbc
 
 
-RUN curl -L -o mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.14/mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz
-RUN tar -xvzf mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz
-RUN cp mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64/lib/mariadb/libm* /usr/lib/
+#RUN curl -L -o mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.14/mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz
+RUN curl -L -o mariadb-connector-odbc-3.1.17-debian-bullseye-amd64.tar.gz https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.17/mariadb-connector-odbc-3.1.17-debian-bullseye-amd64.tar.gz
+
+#RUN tar -xvzf mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64.tar.gz
+#RUN cp mariadb-connector-odbc-3.1.14-debian-9-stretch-amd64/lib/mariadb/libm* /usr/lib/
+RUN tar -xvzf mariadb-connector-odbc-3.1.17-debian-bullseye-amd64.tar.gz
+RUN cp mariadb-connector-odbc-3.1.17-debian-bullseye-amd64/lib/mariadb/libm* /usr/lib/
 
 
 COPY --from=build /usr/local/unixODBC /usr/local/unixODBC
 COPY --from=build /usr/local/unixODBC /usr/local/unixODBC
 
 

+ 8 - 5
frameworks/CSharp/appmpower/appmpower-odbc-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 RUN apt-get update
 RUN apt-get update
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
 RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
@@ -9,11 +9,13 @@ WORKDIR /odbc
 
 
 # To compile the latest postgresql odbc driver, postgresql itself needs to be installed
 # To compile the latest postgresql odbc driver, postgresql itself needs to be installed
 #RUN curl -L -o postgresql-14.1.tar.gz https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.gz
 #RUN curl -L -o postgresql-14.1.tar.gz https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.gz
-RUN curl -L -o unixODBC-2.3.9.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz
+#RUN curl -L -o unixODBC-2.3.9.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz
+RUN curl -L -o unixODBC-2.3.11.tar.gz ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.11.tar.gz
 #RUN curl -L -o psqlodbc-13.02.0000.tar.gz https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-13.02.0000.tar.gz
 #RUN curl -L -o psqlodbc-13.02.0000.tar.gz https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-13.02.0000.tar.gz
 
 
 #RUN tar -xvf postgresql-14.1.tar.gz
 #RUN tar -xvf postgresql-14.1.tar.gz
-RUN tar -xvf unixODBC-2.3.9.tar.gz
+#RUN tar -xvf unixODBC-2.3.9.tar.gz
+RUN tar -xvf unixODBC-2.3.11.tar.gz
 #RUN tar -xvf psqlodbc-13.02.0000.tar.gz
 #RUN tar -xvf psqlodbc-13.02.0000.tar.gz
 
 
 #WORKDIR /odbc/postgresql-14.1
 #WORKDIR /odbc/postgresql-14.1
@@ -23,7 +25,8 @@ RUN tar -xvf unixODBC-2.3.9.tar.gz
 
 
 #ENV PATH=/usr/local/pgsql/bin:$PATH
 #ENV PATH=/usr/local/pgsql/bin:$PATH
 
 
-WORKDIR /odbc/unixODBC-2.3.9
+#WORKDIR /odbc/unixODBC-2.3.9
+WORKDIR /odbc/unixODBC-2.3.11
 RUN ./configure --prefix=/usr/local/unixODBC
 RUN ./configure --prefix=/usr/local/unixODBC
 RUN make
 RUN make
 RUN make install
 RUN make install
@@ -40,7 +43,7 @@ COPY src .
 RUN dotnet publish -c Release -o out -r linux-x64  /p:Database=postgresql
 RUN dotnet publish -c Release -o out -r linux-x64  /p:Database=postgresql
 
 
 # Construct the actual image that will run
 # Construct the actual image that will run
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
 
 
 RUN apt-get update
 RUN apt-get update
 # The following installs standard versions unixodbc 2.3.6 and pgsqlodbc 11
 # The following installs standard versions unixodbc 2.3.6 and pgsqlodbc 11

+ 2 - 2
frameworks/CSharp/appmpower/appmpower.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 RUN apt-get update
 RUN apt-get update
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5
 
 
@@ -7,7 +7,7 @@ COPY src .
 RUN dotnet publish -c Release -o out -r linux-x64
 RUN dotnet publish -c Release -o out -r linux-x64
 
 
 # Construct the actual image that will run
 # Construct the actual image that will run
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
 RUN apt-get update
 RUN apt-get update
 
 
 WORKDIR /app
 WORKDIR /app

+ 26 - 8
frameworks/CSharp/appmpower/src/appMpower.ado

@@ -1,26 +1,44 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
 
    <PropertyGroup>
    <PropertyGroup>
-      <TargetFramework>net6.0</TargetFramework>
+      <TargetFramework>net7.0</TargetFramework>
       <OutputType>Exe</OutputType>
       <OutputType>Exe</OutputType>
       <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
       <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 
 
-      <TrimmerDefaultAction>link</TrimmerDefaultAction>
+      <!-- Normal .NET 7 -->
+      <PublishAot>true</PublishAot>
+      <SelfContained>true</SelfContained>
+      <InvariantGlobalization>true</InvariantGlobalization>
+      <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
       <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
       <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
-      <IlcPgoOptimize>true</IlcPgoOptimize>
+      <DebugType>none</DebugType>
+      <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
+
+      <!-- Only some may work - From the experimental AOT version -->
+      <IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
       <IlcTrimMetadata>true</IlcTrimMetadata>
       <IlcTrimMetadata>true</IlcTrimMetadata>
+      <IlcInvariantGlobalization>true</IlcInvariantGlobalization>
+      <IlcGenerateCompleteTypeMetadata>false</IlcGenerateCompleteTypeMetadata>
+
+      <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
 
 
+      <!--
+      <TrimMode>link</TrimMode>
+      -->
+
+      <!-- Opt out of the "easy mode" of the CoreRT compiler (http://aka.ms/OptimizeCoreRT) -->
+      <IlcPgoOptimize>true</IlcPgoOptimize>
+
+      <!-- This benchmark is marked Stripped, so we might as well do this: -->
       <UseSystemResourceKeys>true</UseSystemResourceKeys>
       <UseSystemResourceKeys>true</UseSystemResourceKeys>
       <EventSourceSupport>false</EventSourceSupport>
       <EventSourceSupport>false</EventSourceSupport>
       <DebuggerSupport>false</DebuggerSupport>
       <DebuggerSupport>false</DebuggerSupport>
-      <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
    </PropertyGroup>
    </PropertyGroup>
 
 
    <ItemGroup>
    <ItemGroup>
-      <PackageReference Include="Npgsql" Version="6.0.5" />
-      <PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
-      <PackageReference Include="System.Data.Odbc" Version="6.0.0" />
-      <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" />
+      <PackageReference Include="Npgsql" Version="7.0.0" />
+      <PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
+      <PackageReference Include="System.Data.Odbc" Version="7.0.0" />
    </ItemGroup>
    </ItemGroup>
 
 
    <PropertyGroup>
    <PropertyGroup>

+ 21 - 8
frameworks/CSharp/appmpower/src/appMpower.csproj

@@ -1,35 +1,48 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
 
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 
 
     <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
     <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
-    <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
+
+    <!-- Normal .NET 7 -->
+    <PublishAot>true</PublishAot>
+    <SelfContained>true</SelfContained>
     <InvariantGlobalization>true</InvariantGlobalization>
     <InvariantGlobalization>true</InvariantGlobalization>
+    <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
+    <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
+    <DebugType>none</DebugType>
+    <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
+
+    <!-- Only some may work - From the experimental AOT version -->
+    <IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
+    <IlcTrimMetadata>true</IlcTrimMetadata>
+    <IlcInvariantGlobalization>true</IlcInvariantGlobalization>
+    <IlcGenerateCompleteTypeMetadata>false</IlcGenerateCompleteTypeMetadata>
+
+    <!-- Still works from the experimental AOT version, but high risk -->
     <IlcDisableReflection>true</IlcDisableReflection>
     <IlcDisableReflection>true</IlcDisableReflection>
 
 
+    <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
+
     <!--
     <!--
     <TrimMode>link</TrimMode>
     <TrimMode>link</TrimMode>
     -->
     -->
 
 
     <!-- Opt out of the "easy mode" of the CoreRT compiler (http://aka.ms/OptimizeCoreRT) -->
     <!-- Opt out of the "easy mode" of the CoreRT compiler (http://aka.ms/OptimizeCoreRT) -->
-    <TrimmerDefaultAction>link</TrimmerDefaultAction>
-    <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
     <IlcPgoOptimize>true</IlcPgoOptimize>
     <IlcPgoOptimize>true</IlcPgoOptimize>
-    <IlcTrimMetadata>true</IlcTrimMetadata>
 
 
     <!-- This benchmark is marked Stripped, so we might as well do this: -->
     <!-- This benchmark is marked Stripped, so we might as well do this: -->
     <UseSystemResourceKeys>true</UseSystemResourceKeys>
     <UseSystemResourceKeys>true</UseSystemResourceKeys>
     <EventSourceSupport>false</EventSourceSupport>
     <EventSourceSupport>false</EventSourceSupport>
     <DebuggerSupport>false</DebuggerSupport>
     <DebuggerSupport>false</DebuggerSupport>
-    <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
+
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="System.Data.Odbc" Version="6.0.0" />
-    <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" />
+    <PackageReference Include="System.Data.Odbc" Version="7.0.0" />
   </ItemGroup>
   </ItemGroup>
 
 
   <PropertyGroup>
   <PropertyGroup>