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.0.4 #370

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ce2fd2f
update .net 8
dorthl Jul 31, 2023
d775bb6
docker build
dorthl Jul 31, 2023
2fbf135
remove nuget
dorthl Aug 1, 2023
8d5facc
ChartJs
dorthl Aug 1, 2023
9443313
ChartJs
dorthl Aug 1, 2023
57d9830
Merge branch 'mian' into preview
dorthl Aug 1, 2023
7b9f8bf
update test
dorthl Aug 1, 2023
37e2e98
Merge remote-tracking branch 'origin/mian' into preview
dorthl Aug 1, 2023
b795231
fix
dorthl Aug 1, 2023
5917597
Webcil false
dorthl Aug 1, 2023
d3ca563
dockerignore
dorthl Aug 1, 2023
7ff7950
Merge branch 'mian' into preview
dorthl Aug 1, 2023
13deb93
BlazorWebAssemblyOmitDebugProxyOutput
dorthl Aug 1, 2023
876e882
Merge branch 'mian' into preview
dorthl Aug 1, 2023
36f9cd5
Merge branch 'mian' into preview
dorthl Aug 2, 2023
f65eee9
Merge branch 'mian' into preview
dorthl Aug 2, 2023
2d41f21
Merge branch 'mian' into preview
dorthl Aug 3, 2023
5c319d4
Merge branch 'mian' into preview
dorthl Aug 4, 2023
efebd36
Merge branch 'mian' into preview
dorthl Aug 4, 2023
36b7c4b
config mirror
dorthl Aug 4, 2023
22e70df
Merge branch 'blogifierdotnet:main' into preview
dorthl Aug 4, 2023
047be82
github workflows docker-image
dorthl Aug 4, 2023
66f9902
on up
dorthl Aug 4, 2023
261b436
fix on err
dorthl Aug 4, 2023
607a9fd
rm zh-CH mirror
dorthl Aug 4, 2023
1c77d4b
Merge branch 'mian' into preview
dorthl Aug 7, 2023
25f0f58
Merge branch 'mian' into preview
dorthl Aug 9, 2023
2540942
preview.7
dorthl Aug 9, 2023
b503a49
Merge branch 'mian' into preview
dorthl Aug 9, 2023
6007e67
sdk preview.7
dorthl Aug 9, 2023
dc7a607
aspnet-composite
dorthl Aug 9, 2023
3c1216f
Merge branch 'mian' into preview
dorthl Aug 9, 2023
69d6b8c
Upgrade to Dotnet 8.0.4
anupsarkar-dev Apr 14, 2024
aa4e490
revert appsettings changes
anupsarkar-dev Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions .dockerignore
@@ -1,8 +1,8 @@
.git
**/bin
**/obj
**/node_modules
.git*
**/bin*
**/obj*
**/node_modules*
Dockerfile
docker-compose.yml
deploy/
deploy*
**/package-lock.json
32 changes: 32 additions & 0 deletions .github/workflows/docker-image.yml
@@ -0,0 +1,32 @@
name: build release docker

on:
push:
branches:
- 'preview'
pull_request:
branches:
- 'preview'

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: dorthl/blogifier:preview
11 changes: 7 additions & 4 deletions Dockerfile
@@ -1,15 +1,18 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine as sdk
FROM mcr.microsoft.com/dotnet/sdk:8.0.100-preview.7-alpine3.18 as sdk
# TOTO zh-CH
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache npm
# VOLUME ["/root/.nuget","/root/.local/share/NuGet","/root/.npm"]
# TOTO zh-CH
# CMD [ "npm config set registry http://mirrors.cloud.tencent.com/npm" ]
# Copy everything else and build
COPY ./ /opt/blogifier
WORKDIR /opt/blogifier
RUN ["dotnet","publish", "-c", "Release","/p:RuntimeIdentifier=linux-musl-x64", "./src/Blogifier/Blogifier.csproj","-o","dist" ]

FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine as run
FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-preview.7-alpine3.18-composite as run
# TOTO zh-CH
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
COPY --from=sdk /opt/blogifier/dist /opt/blogifier/
Expand Down
4 changes: 2 additions & 2 deletions docker.sh
@@ -1,3 +1,3 @@
# docker
docker build -t dorthl/blogifier:latest .
docker push dorthl/blogifier:latest
docker build -t dorthl/blogifier:preview .
docker push dorthl/blogifier:preview
2 changes: 1 addition & 1 deletion global.json
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "7.0.400"
"version": "8.0.100-preview.7.23376.3"
}
}
12 changes: 7 additions & 5 deletions src/Blogifier.Admin/Blogifier.Admin.csproj
@@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<!-- <BlazorEnableCompression>false</BlazorEnableCompression> -->
<!--<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>-->
<ClientAssetsDirectory>assets\</ClientAssetsDirectory>
<ClientAssetsRestoreCommand>npm i</ClientAssetsRestoreCommand>
<ClientAssetsBuildCommand>npm run build:$(Configuration)</ClientAssetsBuildCommand>

<!-- https://github.com/dotnet/runtime/issues/89234 -->
<WasmEnableWebcil>false</WasmEnableWebcil>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.10" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" PrivateAssets="all" />
<PackageReference Include="Sotsera.Blazor.Toaster" Version="3.0.0" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Blogifier.Shared/Blogifier.Shared.csproj
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
Expand Down
Expand Up @@ -7,6 +7,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="~/_content/@ThemesStandardConstant.AssemblyName/css/blogifier.css">
<link rel="stylesheet" href="~/_content/@ThemesStandardConstant.AssemblyName/css/account.css">
@await RenderSectionAsync("HeaderScript",false)
</head>
Expand Down
30 changes: 15 additions & 15 deletions src/Blogifier/Blogifier.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<SelfContained>false</SelfContained>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
Expand All @@ -14,25 +14,25 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="7.0.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Minio" Version="5.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="ReverseMarkdown" Version="3.25.0" />
<PackageReference Include="Markdig" Version="0.32.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="ReverseMarkdown" Version="4.3.0" />
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="NETCore.MailKit" Version="2.1.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="7.0.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Blogifier/Controllers/SearchController.cs
Expand Up @@ -21,7 +21,7 @@ public class SearchController : Controller
}

[HttpPost]
public async Task<IActionResult> Post([FromQuery] string term, [FromQuery] int page = 1)
public async Task<IActionResult> Post([FromForm] string term, [FromForm] int page = 1)
{
if (!string.IsNullOrEmpty(term))
{
Expand Down
7 changes: 5 additions & 2 deletions src/Blogifier/Posts/CategoryProvider.cs
@@ -1,6 +1,7 @@
using Blogifier.Data;
using Blogifier.Shared;
using Microsoft.EntityFrameworkCore;
using ReverseMarkdown.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -16,15 +17,17 @@ public CategoryProvider(AppDbContext dbContext) : base(dbContext)

public async Task<List<CategoryItemDto>> GetItemsAsync()
{
if (!_dbContext.Categories.Any())
return new();

return await _dbContext.Categories
.Include(pc => pc.PostCategories)
.GroupBy(m => new { m.Id, m.Content, m.Description })
.Select(m => new CategoryItemDto
{
Id = m.Key.Id,
Category = m.Key.Content,
Description = m.Key.Description,
PostCount = m.Sum(p => p.PostCategories!.Count())
PostCount = _dbContext.PostCategories.Count(s => s.CategoryId == m.Key.Id)
})
.AsNoTracking()
.ToListAsync();
Expand Down
12 changes: 6 additions & 6 deletions tests/Blogifier.Tests/Blogifier.Tests.csproj
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down