Skip to content

Commit

Permalink
Merge pull request #297 from UKGovernmentBEIS/revert-295-PC-1122-Inve…
Browse files Browse the repository at this point in the history
…stigation-into-c#-and-.net-update

Revert "PC:1122 investigation into c# and .net update"
  • Loading branch information
Glenn-Clarke authored Jun 26, 2024
2 parents 07d65a9 + 0bdf84d commit d921205
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Checkout code onto job runner
uses: actions/checkout@v2

- name: Install .Net (8.0)
- name: Install .Net (6.0)
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
dotnet-version: 6.0.x

- name: Restore .Net dependencies
run: dotnet restore --configfile Nuget.config
Expand Down
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/aspnet:8.0 as base
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as base
# Install Chrome
RUN apt-get update && apt-get -f install && apt-get -y install wget gnupg2 apt-utils
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
Expand All @@ -7,7 +7,7 @@ RUN apt-get update \
&& apt-get install -y google-chrome-stable --no-install-recommends --allow-downgrades fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable"

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /SeaPublicWebsite

# Copy everything
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SeaPublicWebsite.Data.Migrations
{
public partial class Initial : Migration
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
Expand Down
3 changes: 1 addition & 2 deletions SeaPublicWebsite.Data/SeaPublicWebsite.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions SeaPublicWebsite.UnitTests/SeaPublicWebsite.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Tests</RootNamespace>
<IsPublishable>false</IsPublishable>
<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion SeaPublicWebsite/Middleware/BasicAuthMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static void AddOrUpdateHeader(HttpContext httpContext, string headerName
}
else
{
httpContext.Response.Headers.Append(headerName, headerValue);
httpContext.Response.Headers.Add(headerName, headerValue);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions SeaPublicWebsite/Middleware/SecurityHeadersMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ public Task Invoke(HttpContext context)
{
if (!context.Response.Headers.ContainsKey("X-Content-Type-Options"))
{
context.Response.Headers.Append("X-Content-Type-Options", "nosniff");
context.Response.Headers.Add("X-Content-Type-Options", "nosniff");
}

if (!context.Response.Headers.ContainsKey("Content-Security-Policy"))
{
context.Response.Headers.Append("Content-Security-Policy",
context.Response.Headers.Add("Content-Security-Policy",
"default-src 'self'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'");

}

if (!context.Response.Headers.ContainsKey("Referrer-Policy"))
{
context.Response.Headers.Append("Referrer-Policy", "no-referrer");
context.Response.Headers.Add("Referrer-Policy", "no-referrer");

}

Expand Down
4 changes: 2 additions & 2 deletions SeaPublicWebsite/SeaPublicWebsite.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<UserSecretsId>b88a2d94-9041-47c6-ab29-ff57149dd347</UserSecretsId>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
Expand Down
3 changes: 1 addition & 2 deletions SeaPublicWebsite/Services/StaticAssetsVersioningService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -27,7 +26,7 @@ public StaticAssetsVersioningService(IWebHostEnvironment environment)
private const string AppJsRegex = "app-.*.js";
private const string Html5ShivJsRegex = "html5shiv-.*.js";

private ConcurrentDictionary<string, string> cachedFilenames = new();
private Dictionary<string, string> cachedFilenames = new Dictionary<string, string>();

public string GetAppCssFilename() => GetStaticFile(CompiledDirectory, AppCssRegex);
public string GetAppIe8CssFilename() => GetStaticFile(CompiledDirectory, AppIe8CssRegex);
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ services:
- "5001:80"
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_HTTP_PORTS: "80"
volumes:
# map the dotnet user-secret folder
- $APPDATA/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
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": "8.0",
"version": "5.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
Expand Down

0 comments on commit d921205

Please sign in to comment.