feat: upgrade .NET 8

This commit is contained in:
geffzhang 2024-01-27 15:57:56 +08:00
parent 8ca8e4444f
commit d180d67602
14 changed files with 81 additions and 30 deletions

View file

@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<BotSharpVersion>0.22.0</BotSharpVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>

49
dockerfiles/Dockerfile Normal file
View file

@ -0,0 +1,49 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Directory.Build.props", "."]
COPY ["src/WebStarter/WebStarter.csproj", "src/WebStarter/"]
COPY ["tests/BotSharp.Plugin.PizzaBot/BotSharp.Plugin.PizzaBot.csproj", "tests/BotSharp.Plugin.PizzaBot/"]
COPY ["src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj", "src/Infrastructure/BotSharp.Core/"]
COPY ["src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj", "src/Infrastructure/BotSharp.Abstraction/"]
COPY ["src/Infrastructure/BotSharp.Logger/BotSharp.Logger.csproj", "src/Infrastructure/BotSharp.Logger/"]
COPY ["src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj", "src/Infrastructure/BotSharp.OpenAPI/"]
COPY ["src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj", "src/Plugins/BotSharp.Plugin.GoogleAI/"]
COPY ["src/Plugins/BotSharp.Plugin.MongoStorage/BotSharp.Plugin.MongoStorage.csproj", "src/Plugins/BotSharp.Plugin.MongoStorage/"]
COPY ["src/Plugins/BotSharp.Plugin.AzureOpenAI/BotSharp.Plugin.AzureOpenAI.csproj", "src/Plugins/BotSharp.Plugin.AzureOpenAI/"]
COPY ["src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj", "src/Plugins/BotSharp.Plugin.ChatbotUI/"]
COPY ["src/Plugins/BotSharp.Plugin.HuggingFace/BotSharp.Plugin.HuggingFace.csproj", "src/Plugins/BotSharp.Plugin.HuggingFace/"]
COPY ["src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj", "src/Plugins/BotSharp.Plugin.KnowledgeBase/"]
COPY ["src/Plugins/BotSharp.Plugin.MetaAI/BotSharp.Plugin.MetaAI.csproj", "src/Plugins/BotSharp.Plugin.MetaAI/"]
COPY ["src/Plugins/BotSharp.Plugin.MetaMessenger/BotSharp.Plugin.MetaMessenger.csproj", "src/Plugins/BotSharp.Plugin.MetaMessenger/"]
COPY ["src/Plugins/BotSharp.Plugin.Qdrant/BotSharp.Plugin.Qdrant.csproj", "src/Plugins/BotSharp.Plugin.Qdrant/"]
COPY ["src/Plugins/BotSharp.Plugin.RoutingSpeeder/BotSharp.Plugin.RoutingSpeeder.csproj", "src/Plugins/BotSharp.Plugin.RoutingSpeeder/"]
COPY ["src/Plugins/BotSharp.Plugin.WeChat/BotSharp.Plugin.WeChat.csproj", "src/Plugins/BotSharp.Plugin.WeChat/"]
COPY ["src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj", "src/Plugins/BotSharp.Plugin.SemanticKernel/"]
COPY ["src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj", "src/Plugins/BotSharp.Plugin.Twilio/"]
COPY ["src/Plugins/BotSharp.Plugin.TelegramBots/BotSharp.Plugin.TelegramBots.csproj", "src/Plugins/BotSharp.Plugin.TelegramBots/"]
COPY ["src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj", "src/Plugins/BotSharp.Plugin.ChatHub/"]
COPY ["src/Plugins/BotSharp.Plugin.HttpHandler/BotSharp.Plugin.HttpHandler.csproj", "src/Plugins/BotSharp.Plugin.HttpHandler/"]
COPY ["src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj", "src/Plugins/BotSharp.Plugin.LLamaSharp/"]
COPY ["src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj", "src/Plugins/BotSharp.Plugin.SqlDriver/"]
COPY ["src/Plugins/BotSharp.Plugin.WebDriver/BotSharp.Plugin.WebDriver.csproj", "src/Plugins/BotSharp.Plugin.WebDriver/"]
RUN dotnet restore "./src/WebStarter/./WebStarter.csproj"
COPY . .
WORKDIR "/src/src/WebStarter"
RUN dotnet build "./WebStarter.csproj" -c $BUILD_CONFIGURATION -o /app/build /p:SolutionName=BotSharp
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WebStarter.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:SolutionName=BotSharp
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebStarter.dll"]

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>$(LangVersion)</LangVersion>
@ -19,9 +19,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.26" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.1" />
</ItemGroup>
<ItemGroup>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>$(LangVersion)</LangVersion>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>$(LangVersion)</LangVersion>
<VersionPrefix>$(BotSharpVersion)</VersionPrefix>

View file

@ -12,14 +12,14 @@
<ItemGroup>
<PackageReference Include="Docnet.Core" Version="2.7.0-alpha.1" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.3.0" />
<PackageReference Include="Magick.NET.Core" Version="13.3.0" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.7.0.20230115" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.5.0" />
<PackageReference Include="Magick.NET.Core" Version="13.5.0" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.9.0.20240103" />
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.mkl" Version="2.5.1" />
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0.1" />
<PackageReference Include="Sdcb.PaddleOCR.Models.LocalV3" Version="2.7.0.1" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0-preview.7.23375.5" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
</ItemGroup>
<ItemGroup>

View file

@ -30,7 +30,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="TensorFlow.Keras" Version="0.11.4" />
<PackageReference Include="TensorFlow.Keras" Version="0.15.0" />
</ItemGroup>
<ItemGroup>

View file

@ -11,8 +11,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.21" />
<PackageReference Include="MySqlConnector" Version="2.3.0" />
<PackageReference Include="Dapper" Version="2.1.28" />
<PackageReference Include="MySqlConnector" Version="2.3.5" />
</ItemGroup>
<ItemGroup>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>$(LangVersion)</LangVersion>
<VersionPrefix>$(BotSharpVersion)</VersionPrefix>
<GeneratePackageOnBuild>$(GeneratePackageOnBuild)</GeneratePackageOnBuild>
@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StrongGrid" Version="0.102.0" />
<PackageReference Include="StrongGrid" Version="0.104.0" />
<PackageReference Include="Twilio.AspNet.Common" Version="8.0.2" />
<PackageReference Include="Twilio.AspNet.Core" Version="8.0.2" />
</ItemGroup>

View file

@ -27,8 +27,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.Weixin.MP.Middleware" Version="0.8.6" />
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
<PackageReference Include="Senparc.Weixin.MP.Middleware" Version="1.1.1" />
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
</ItemGroup>
</Project>

View file

@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Playwright" Version="1.39.0" />
<PackageReference Include="Microsoft.Playwright" Version="1.41.1" />
</ItemGroup>
<ItemGroup>

View file

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<UserSecretsId>4fb8c9df-7975-4926-ba73-46c8ca440691</UserSecretsId>
<ContainerRepository>botsharpwebapi</ContainerRepository>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup Condition="$(SolutionName)==PizzaBot">
@ -25,11 +27,11 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
</ItemGroup>
<ItemGroup>
<!--<ItemGroup>
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
</ItemGroup>
</ItemGroup>-->
<ItemGroup Condition="$(SolutionName)==BotSharp">
<ItemGroup>
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />

View file

@ -19,16 +19,16 @@
"Models": [
{
"Name": "gpt-35-turbo",
"ApiKey": "",
"Endpoint": "https://gpt-35-turbo.openai.azure.com/",
"ApiKey": "c1cee6ddfb3d4f469587789efe7a2ba9",
"Endpoint": "https://ai4c-demo.openai.azure.com/",
"Type": "chat",
"PromptCost": 0.0015,
"CompletionCost": 0.002
},
{
"Name": "gpt-35-turbo-instruct",
"ApiKey": "",
"Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/",
"Name": "gpt-35-turbo",
"ApiKey": "c1cee6ddfb3d4f469587789efe7a2ba9",
"Endpoint": "https://ai4c-demo.openai.azure.com/",
"Type": "text",
"PromptCost": 0.0015,
"CompletionCost": 0.002

View file

@ -12,9 +12,9 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta6" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.1.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>