Skip to content

Commit

Permalink
.NET 8 Upgrade (#436)
Browse files Browse the repository at this point in the history
* refactor: .NET 8 migration

* Fix main merge

* Package updates to latest

---------

Co-authored-by: Chris Gårdenberg <[email protected]>
Co-authored-by: NoLifeKing <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2024
1 parent 6ad63e4 commit e291918
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Build Opserver Docker Image
run: |
docker build --tag opserver/opserver-ci:latest --target web .
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- uses: actions/checkout@v1
dotnet-version: 8.0.x
- uses: actions/checkout@v3
- name: Build with dotnet
run: dotnet build
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app

# Global
Expand All @@ -22,7 +22,7 @@ WORKDIR /app/src/Opserver.Web
RUN dotnet publish -c Release -o publish

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS web
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS web
WORKDIR /app
COPY --from=web-publish /app/src/Opserver.Web/publish ./
ENTRYPOINT ["dotnet", "Opserver.Web.dll"]
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image: Visual Studio 2019

install:
- choco install dotnet-sdk --version 6.0.100
- choco install dotnet-sdk --version 8.0.100

skip_branch_with_pr: true
skip_tags: true
Expand Down
2 changes: 1 addition & 1 deletion src/Opserver.Core/Helpers/OpserverConfigException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class OpserverConfigException : Exception
public OpserverConfigException() { }
public OpserverConfigException(string message) : base(message) { }
public OpserverConfigException(string message, Exception innerException) : base(message, innerException) { }
protected OpserverConfigException(SerializationInfo info, StreamingContext context) : base(info, context) { }
protected OpserverConfigException(SerializationInfo info, StreamingContext context) { }
}
}
32 changes: 18 additions & 14 deletions src/Opserver.Core/Opserver.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@
<PropertyGroup>
<RootNamespace>Opserver</RootNamespace>
<AssemblyName>Opserver.Core</AssemblyName>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Enums.NET" Version="4.0.0" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Enums.NET" Version="5.0.0" />
<PackageReference Include="Jil" Version="2.17.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
<PackageReference Include="MiniProfiler.Shared" Version="4.3.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.10" />
<PackageReference Include="MiniProfiler.Shared" Version="4.3.13" />
<PackageReference Include="Sigil" Version="5.0.0" />
<PackageReference Include="StackExchange.Exceptional.Shared" Version="2.2.32" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="StackExchange.Exceptional.Shared" Version="2.2.35" />
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
<PackageReference Include="StackExchange.Utils.Http" Version="0.3.48" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.DirectoryServices" Version="6.0.0" />
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
<PackageReference Include="System.DirectoryServices" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.Runtime.Caching" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<Compile Update="Data\SQL\QueryPlans\ShowPlanXML.cs" SubType="Code" />
<Compile Update="Data\SQL\QueryPlans\ShowPlanXML.generated.cs" SubType="Code" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.143" />
</ItemGroup>
</Project>
16 changes: 10 additions & 6 deletions src/Opserver.Web/Opserver.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>Opserver</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Opserver.Core\Opserver.Core.csproj" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" PrivateAssets="all" />
<PackageReference Include="BuildWebCompiler" Condition="'$(OS)' == 'Windows_NT'" Version="1.12.405" PrivateAssets="all" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.35.0" />
<PackageReference Include="StackExchange.Exceptional.AspNetCore" Version="2.2.32" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="6.0.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.3.13" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.1.2" />
<PackageReference Include="StackExchange.Exceptional.AspNetCore" Version="2.2.35" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.1" />
<Reference Include="System.Management" />
</ItemGroup>
<ItemGroup>
Expand All @@ -23,4 +23,8 @@
<None Include="Config\*.example.json" />
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.143" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions src/Opserver.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -158,7 +157,7 @@ public void ConfigureServices(IServiceCollection services)
foreach (var knownNetwork in knownNetworks)
{
var ipNet = IPNet.Parse(knownNetwork);
options.KnownNetworks.Add(new IPNetwork(ipNet.IPAddress, ipNet.CIDR));
options.KnownNetworks.Add(new Microsoft.AspNetCore.HttpOverrides.IPNetwork(ipNet.IPAddress, ipNet.CIDR));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Opserver.Web/wwwroot/Content/themes/dark.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Opserver.Web/wwwroot/Content/themes/light.css

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions tests/Opserver.Tests/Opserver.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
<PropertyGroup>
<RootNamespace>Opserver.Tests</RootNamespace>
<AssemblyName>Opserver.Tests</AssemblyName>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/Opserver.Web/Opserver.Web.csproj" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Update="xunit" Version="2.9.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

0 comments on commit e291918

Please sign in to comment.