Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET 8 #191

Merged
merged 9 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 42 additions & 39 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
{
"name": "Azure Developer CLI",
"image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0-bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/azure-cli:1.2.1": {},
"ghcr.io/devcontainers/features/github-cli:1.0.9": {},
"ghcr.io/azure/azure-dev/azd:latest": {}
"name": "Azure Search OpenAI Demo - C#",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/azure-cli:1.2.1": {},
"ghcr.io/devcontainers/features/github-cli:1.0.9": {},
"ghcr.io/devcontainers/features/powershell:1.1.0": {},
"ghcr.io/azure/azure-dev/azd:latest": {},
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "8.0"
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.azure-dev",
"ms-azuretools.vscode-bicep",
"ms-azuretools.vscode-docker",
"ms-vscode.vscode-node-azure-pack",
"ms-dotnettools.csharp",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-azuretools.vscode-azurefunctions",
"ms-azuretools.vscode-cosmosdb",
"ms-azuretools.vscode-azurestorage",
"ms-vscode.azurecli",
"ms-kubernetes-tools.vscode-aks-tools",
"ms-kubernetes-tools.aks-devx-tools",
"ms-azuretools.vscode-azurecontainerapps",
"ms-azuretools.vscode-azureeventgrid",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ipedrazas.kubernetes-snippets",
"redhat.vscode-yaml",
"GitHub.vscode-github-actions"
]
}
},
"forwardPorts": [
5000
],
"postCreateCommand": "",
"remoteUser": "vscode",
"hostRequirements": {
"memory": "8gb"
"ghcr.io/devcontainers/features/node:1": {
"version": "20.6.1"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"ms-azuretools.vscode-azurefunctions",
"ms-azuretools.vscode-azurestorage",
"ms-azuretools.vscode-azurecontainerapps",
"ms-dotnettools.csdevkit",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-dotnettools.blazorwasm-companion",
"ms-kubernetes-tools.vscode-aks-tools",
"ms-kubernetes-tools.aks-devx-tools",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ipedrazas.kubernetes-snippets",
"redhat.vscode-yaml",
"GitHub.vscode-github-actions",
"esbenp.prettier-vscode"
]
}
}
},
"forwardPorts": [
5000
],
"postCreateCommand": "",
"remoteUser": "vscode",
"hostRequirements": {
"memory": "8gb"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Log in with Azure (Federated Credentials)
if: ${{ env.AZURE_CLIENT_ID != '' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ./app/app.sln
- name: Build
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dotnet/.config
*.user
*.userosscache
*.sln.docstates
nuget.config

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
22 changes: 16 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"recommendations": [
"ms-azuretools.azure-dev",
"ms-azuretools.vscode-bicep",
"ms-dotnettools.blazorwasm-companion",
"ms-dotnettools.csharp",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-azuretools.vscode-azurefunctions",
"ms-dotnettools.csharp",
"ms-azuretools.vscode-docker",
"ms-azuretools.vscode-azurestorage",
"ms-azuretools.vscode-azurecontainerapps",
"ms-dotnettools.csdevkit",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-dotnettools.blazorwasm-companion",
"ms-kubernetes-tools.vscode-aks-tools",
"ms-kubernetes-tools.aks-devx-tools",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ipedrazas.kubernetes-snippets",
"redhat.vscode-yaml",
"GitHub.vscode-github-actions",
"esbenp.prettier-vscode"
]
}
}
82 changes: 40 additions & 42 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,48 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch (current file)",
"script": "${file}",
"args": [],
"cwd": "${file}"
{
"name": "Frontend: Blazor client",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}//app/backend/bin/Debug/net8.0/ClientApp.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
{
"name": "Frontend: Blazor client",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/app/frontend/bin/Debug/net7.0/ClientApp.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"envFile": "${input:dotEnvFilePath}"
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
{
"name": "Backend: Minimal API",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/app/backend/bin/Debug/net7.0/MinimalApi.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole",
"envFile": "${input:dotEnvFilePath}"
}
"envFile": "${input:dotEnvFilePath}"
},
{
"name": "Backend: Minimal API",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/app/backend/bin/Debug/net8.0/MinimalApi.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole",
"envFile": "${input:dotEnvFilePath}"
}
],
"inputs": [
{
"id": "dotEnvFilePath",
"type": "command",
"command": "azure-dev.commands.getDotEnvFilePath"
}
{
"id": "dotEnvFilePath",
"type": "command",
"command": "azure-dev.commands.getDotEnvFilePath"
}
],
"compounds": [
{
"name": "Full Stack",
"configurations": ["Backend: Minimal API", "Frontend: Blazor client"]
}
]
}
}
24 changes: 15 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"search.exclude": {
"static": true
"static": true
},
"dotnet.defaultSolution": "app/app.sln"
}
"dotnet.defaultSolution": "app/app.sln",
"azureFunctions.deploySubpath": "app/functions/EmbedFunctions/bin/Release/net8.0/publish",
"azureFunctions.projectLanguage": "C#",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.projectSubpath": "app/functions/EmbedFunctions",
"azureFunctions.preDeployTask": "publish (functions)"
}
47 changes: 47 additions & 0 deletions app/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Azure.AI.FormRecognizer" Version="4.1.0" />
<PackageVersion Include="Azure.AI.OpenAI" Version="1.0.0-beta.8" />
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
<PackageVersion Include="Azure.Identity" Version="1.10.2" />
<PackageVersion Include="Azure.Search.Documents" Version="11.5.0-beta.5" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageVersion Include="Azure.Storage.Files.Shares" Version="12.16.0" />
<PackageVersion Include="Azure.Storage.Queues" Version="12.16.0" />
<PackageVersion Include="Blazor.LocalStorage.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Blazor.SessionStorage.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Blazor.SpeechRecognition.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Blazor.SpeechSynthesis.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="bunit" Version="1.24.10" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Markdig" Version="0.33.0" />
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0-beta3" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.2.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.15.1" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.0-rc.2.23480.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0-rc.2.23479.6" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0-rc.2.23479.6" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0-rc.2.23479.6" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0-rc.2.23479.6" />
<PackageVersion Include="Microsoft.ML" Version="2.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageVersion Include="MudBlazor" Version="6.11.0" />
<PackageVersion Include="PdfSharpCore" Version="1.3.62" />
<PackageVersion Include="Pinecone.NET" Version="1.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="xunit" Version="2.5.2" />
</ItemGroup>
</Project>
7 changes: 4 additions & 3 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#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:7.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 8080
EXPOSE 443

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Directory.Build.props", "."]
COPY ["Directory.Packages.props", "."]
COPY ["backend/", "backend/"]
COPY ["frontend/", "frontend/"]
COPY ["shared/", "shared/"]
Expand Down
5 changes: 3 additions & 2 deletions app/app.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\.gitignore = ..\.gitignore
..\.github\workflows\azure-dev.yml = ..\.github\workflows\azure-dev.yml
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
..\.github\workflows\dotnet-build.yml = ..\.github\workflows\dotnet-build.yml
global.json = global.json
..\LICENSE = ..\LICENSE
nuget.config = nuget.config
..\README.md = ..\README.md
EndProjectSection
EndProject
Expand All @@ -25,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp.Tests", "tests\Cl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareDocs", "prepdocs\PrepareDocs\PrepareDocs.csproj", "{9C39AF95-2BB1-48CF-BD12-D214C0BD6076}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbedFunctions", "functions\EmbedFunctions\EmbedFunctions.csproj", "{54099AF3-CFA8-4EA9-9118-A26E3E63745B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmbedFunctions", "functions\EmbedFunctions\EmbedFunctions.csproj", "{54099AF3-CFA8-4EA9-9118-A26E3E63745B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
9 changes: 5 additions & 4 deletions app/backend/Extensions/SearchClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ internal static async Task<string> QueryDocumentsAsync(
if (embedding != null && overrides?.RetrievalMode != "Text")
{
var k = useSemanticRanker ? 50 : top;
var vectorQuery = new SearchQueryVector
var vectorQuery = new RawVectorQuery
IEvangelist marked this conversation as resolved.
Show resolved Hide resolved
{
// if semantic ranker is enabled, we need to set the rank to a large number to get more
// candidates for semantic reranking
KNearestNeighborsCount = useSemanticRanker ? 50 : top,
Value = embedding,
Vector = embedding,
};
vectorQuery.Fields.Add("embedding");
searchOption.Vectors.Add(vectorQuery);
searchOption.VectorQueries.Add(vectorQuery);
}

var searchResultResponse = await searchClient.SearchAsync<SearchDocument>(query, searchOption, cancellationToken);
var searchResultResponse = await searchClient.SearchAsync<SearchDocument>(
query, searchOption, cancellationToken);
if (searchResultResponse.Value is null)
{
throw new InvalidOperationException("fail to get search result");
Expand Down
7 changes: 1 addition & 6 deletions app/backend/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
global using Azure.Storage.Blobs.Models;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.AspNetCore.Mvc.RazorPages;
global using Microsoft.ML;
global using Microsoft.ML.Transforms.Text;
global using Microsoft.SemanticKernel;
global using Microsoft.SemanticKernel.AI;
global using Microsoft.SemanticKernel.AI.ChatCompletion;
global using Microsoft.SemanticKernel.AI.Embeddings;
global using Microsoft.SemanticKernel.AI.TextCompletion;
global using Microsoft.SemanticKernel.Memory;
global using Microsoft.SemanticKernel.Orchestration;
global using MinimalApi.Extensions;
global using MinimalApi.Services;
global using PdfSharpCore.Pdf;
Expand Down
Loading
Loading