Skip to content

Commit

Permalink
1st try of migration to dotnet 8.
Browse files Browse the repository at this point in the history
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
  • Loading branch information
ChaosEngine committed Dec 1, 2023
1 parent 4b5bb0c commit 97b0264
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax = docker/dockerfile:experimental
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-bullseye-slim AS build
RUN --mount=type=cache,target=/root/.nuget --mount=type=cache,target=/root/.local/share/NuGet --mount=type=cache,target=/root/.npm/ --mount=type=cache,target=./DotnetPlayground.Web/node_modules
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh && \
chmod 500 nsolid_setup_deb.sh && \
Expand Down Expand Up @@ -35,7 +35,7 @@ RUN dotnet publish --no-restore -c $BUILD_CONFIG --self-contained -r linux-x64 \



FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-bullseye-slim
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-bullseye-slim
WORKDIR /app
ENV USER=nobody TZ=Europe/Warsaw ASPNETCORE_URLS=http://+:5000
ARG BUILD_CONFIG=${BUILD_CONFIG:-Release}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax = docker/dockerfile:experimental
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
RUN --mount=type=cache,target=/root/.nuget --mount=type=cache,target=/root/.local/share/NuGet --mount=type=cache,target=/root/.npm/ --mount=type=cache,target=./DotnetPlayground.Web/node_modules
RUN apk add --update nodejs npm
WORKDIR /build
Expand Down Expand Up @@ -32,7 +32,7 @@ RUN dotnet publish --no-restore -c $BUILD_CONFIG --self-contained -r alpine-x64



FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
RUN apk add tzdata
WORKDIR /app
ENV USER=nobody TZ=Europe/Warsaw ASPNETCORE_URLS=http://+:5000
Expand Down
4 changes: 2 additions & 2 deletions Dotnet-Playground build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ dockerfile_args=''

case $1 in
"latest"|"ubuntu"|"default"|"debian")
image="latest";
image="latest-8";
dockerfile_name="Dockerfile";
echo "image would be $image";
;;
"" | "alpine")
image="alpine";
image="alpine-8";
dockerfile_name="Dockerfile.alpine";
echo "image would be $image";
;;
Expand Down
12 changes: 6 additions & 6 deletions DotnetPlayground.Tests/DotnetPlayground.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<IsPackable>false</IsPackable>
Expand All @@ -10,21 +10,21 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0-rc.2.23479.6" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion DotnetPlayground.Tests/WebCamGalleryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void OnImageGetTest(string imageName)
long etagHash = new DateTimeOffset(last.Year, last.Month, last.Day, last.Hour, last.Minute, last.Second, last.Offset)
.ToUniversalTime().ToFileTime() ^ fi.Length;
var etag_str = '\"' + Convert.ToString(etagHash, 16) + '\"';
wcim.Request.Headers.Add(HeaderNames.IfNoneMatch, new StringValues(etag_str));
wcim.Request.Headers.Append(HeaderNames.IfNoneMatch, new StringValues(etag_str));

//Act
result = wcim.OnGet(base.Configuration, serverTiming_mock.Object, imageName);
Expand Down
12 changes: 6 additions & 6 deletions DotnetPlayground.Web/Areas/Identity/OAuthHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class MyGoogleHandler : GoogleHandler
{
//private readonly IConfiguration _configuration;

public MyGoogleHandler(IOptionsMonitor<GoogleOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IConfiguration configuration)
: base(options, logger, encoder, clock)
public MyGoogleHandler(IOptionsMonitor<GoogleOptions> options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration configuration)
: base(options, logger, encoder)
{
//_configuration = configuration;
}
Expand All @@ -38,8 +38,8 @@ public class MyTwitterHandler : TwitterHandler
{
//private readonly IConfiguration _configuration;

public MyTwitterHandler(IOptionsMonitor<TwitterOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IConfiguration configuration)
: base(options, logger, encoder, clock)
public MyTwitterHandler(IOptionsMonitor<TwitterOptions> options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration configuration)
: base(options, logger, encoder)
{
//_configuration = configuration;
}
Expand Down Expand Up @@ -72,8 +72,8 @@ public GitHubOptions()
}
}

public MyGithubHandler(IOptionsMonitor<GitHubOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IConfiguration configuration)
: base(options, logger, encoder, clock)
public MyGithubHandler(IOptionsMonitor<GitHubOptions> options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration configuration)
: base(options, logger, encoder)
{
//_configuration = configuration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
using System.Threading.Tasks;
using DotnetPlayground.Models;
using DotnetPlayground.Web.Helpers;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;

namespace IdentitySample.DefaultUI
{
Expand Down Expand Up @@ -83,7 +85,7 @@ public override async Task<IActionResult> OnPostAsync()

personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user));

Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
Response.Headers.Append("Content-Disposition", "attachment; filename=PersonalData.json");
return new FileContentResult(Encoding.UTF8.GetBytes(
JsonSerializer.Serialize(personalData, DictStringString_Context.Default.DictionaryStringString)),
"text/json");
Expand Down
32 changes: 16 additions & 16 deletions DotnetPlayground.Web/DotnetPlayground.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Version>1.0.25-inkball</Version>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<AssemblyName>DotnetPlayground.Web</AssemblyName>
<OutputType>Exe</OutputType>
Expand Down Expand Up @@ -36,24 +36,24 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.14" Condition="$(DefineConstants.Contains('INCLUDE_SQLSERVER'))" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="7.0.14" Condition="$(DefineConstants.Contains('INCLUDE_SQLSERVER'))" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.14" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" Condition="$(DefineConstants.Contains('INCLUDE_POSTGRES'))" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" Condition="$(DefineConstants.Contains('INCLUDE_MYSQL'))" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.0-rc.1.23421.29" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-rc.2.23480.1" Condition="$(DefineConstants.Contains('INCLUDE_SQLSERVER'))" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="8.0.0-rc.2.23480.2" Condition="$(DefineConstants.Contains('INCLUDE_SQLSERVER'))" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.2" Condition="$(DefineConstants.Contains('INCLUDE_POSTGRES'))" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2.ci.20231014172607" Condition="$(DefineConstants.Contains('INCLUDE_MYSQL'))" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="7.21.12" Condition="$(DefineConstants.Contains('INCLUDE_ORACLE'))" />
<PackageReference Include="IdentityManager2.AspNetIdentity" Version="1.0.0" />
<PackageReference Include="Lib.AspNetCore.ServerTiming" Version="6.0.0" />
<!--<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.16.2" Condition="$(DefineConstants.Contains('INCLUDE_COSMOSDB'))" />-->
<PackageReference Include="MongoDB.Driver" Version="2.22.0" Condition="$(DefineConstants.Contains('INCLUDE_MONGODB'))" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.64.0.3205" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="MessagePack" Version="2.5.140" />
</ItemGroup>

Expand All @@ -76,9 +76,9 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.24" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
9 changes: 9 additions & 0 deletions DotnetPlayground.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,15 @@ public void ConfigureServices(IServiceCollection services)
jsonInputFormatter.SupportedMediaTypes.Add(CspReportRequest.ContentType);

})
//.AddRazorRuntimeCompilation(options =>
//{
// //options.AdditionalReferencePaths.Add(Path.Combine(
// // env.ContentRootPath, "../InkBall/src/InkBall.Module"
// // ));

// var libPath = Path.GetFullPath(Path.Combine(env.ContentRootPath, "../InkBall/src/InkBall.Module"));
// options.FileProviders.Add(new PhysicalFileProvider(libPath));
//})
.AddSessionStateTempDataProvider();
services.AddRazorPages();

Expand Down
2 changes: 1 addition & 1 deletion DotnetPlayground.Web/web.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="InProcess">
<environmentVariables />
</aspNetCore>
</system.webServer>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.0",
"version": "8.0.0",
"rollForward": "latestMajor"
},
"projects": [ "DotnetPlayground.Web", "DotnetPlayground.Tests", "Caching-MySQL", "InkBall", "IdentityManager2" ]
Expand Down

0 comments on commit 97b0264

Please sign in to comment.