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 .net to 8 #69

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:80
ENV FileStorageOptions__Path=/app/files
Expand Down
10 changes: 3 additions & 7 deletions SecureSend.Application/SecureSend.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SecureSend.Domain\SecureSend.Domain.csproj" />
</ItemGroup>

</Project>
</Project>
9 changes: 3 additions & 6 deletions SecureSend.Domain/SecureSend.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.4" />
</ItemGroup>

</Project>
</Project>
20 changes: 6 additions & 14 deletions SecureSend.Infrastructure/SecureSend.Infrastructure.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SecureSend.Application\SecureSend.Application.csproj" />
</ItemGroup>


</Project>
</Project>
21 changes: 9 additions & 12 deletions SecureSend.PostgresMigrations/SecureSend.PostgresMigrations.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<ProjectReference Include="..\SecureSend.Infrastructure\SecureSend.Infrastructure.csproj" />
</ItemGroup>

</Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SecureSend.Infrastructure\SecureSend.Infrastructure.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>SecureSend.SqlServerMigration</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SecureSend.Infrastructure\SecureSend.Infrastructure.csproj" />
</ItemGroup>

</Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>SecureSend.SqlServerMigration</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SecureSend.Infrastructure\SecureSend.Infrastructure.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions SecureSend.Test/Domain/SecureSendUploadTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ public void RemoveFile_Succeeds()
[Fact]
public void VerifyHash_Throws_InvalidPasswordException()
{
var exception = Record.Exception(() => upload.PasswordHash.VerifyHash("wrong password"));
var exception = Record.Exception(() => upload!.PasswordHash!.VerifyHash("wrong password"));
Assert.NotNull(exception);
Assert.IsType<InvalidPasswordException>(exception);
}

[Fact]
public void VerifyHash_Succeeds()
{
upload.PasswordHash.VerifyHash("testing");
upload!.PasswordHash!.VerifyHash("testing");
}
}
56 changes: 24 additions & 32 deletions SecureSend.Test/SecureSend.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\SecureSend.Application\SecureSend.Application.csproj" />
</ItemGroup>



</Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SecureSend.Application\SecureSend.Application.csproj" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions SecureSend.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend", "SecureSend\SecureSend.csproj", "{EB9A5562-34AB-4CAB-B488-5E68C4218270}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.Domain", "SecureSend.Domain\SecureSend.Domain.csproj", "{F0487577-AF18-46AC-9478-DBA2498F2308}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.Domain", "SecureSend.Domain\SecureSend.Domain.csproj", "{F0487577-AF18-46AC-9478-DBA2498F2308}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.Application", "SecureSend.Application\SecureSend.Application.csproj", "{B5B5EA9A-8A59-4493-A64B-E9894266B6BA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.Application", "SecureSend.Application\SecureSend.Application.csproj", "{B5B5EA9A-8A59-4493-A64B-E9894266B6BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.Infrastructure", "SecureSend.Infrastructure\SecureSend.Infrastructure.csproj", "{9E79BF8F-C9D8-4E0A-995C-AE5D4B0DEACD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.Infrastructure", "SecureSend.Infrastructure\SecureSend.Infrastructure.csproj", "{9E79BF8F-C9D8-4E0A-995C-AE5D4B0DEACD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.SqlServerMigrations", "SecureSend.SqlServerMigrations\SecureSend.SqlServerMigrations.csproj", "{39CE0185-967A-45CD-8083-FEE3E69BC907}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.SqlServerMigrations", "SecureSend.SqlServerMigrations\SecureSend.SqlServerMigrations.csproj", "{39CE0185-967A-45CD-8083-FEE3E69BC907}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.PostgresMigrations", "SecureSend.PostgresMigrations\SecureSend.PostgresMigrations.csproj", "{EBF94ECB-C3A4-4F80-8F34-31F8A82B1E81}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.PostgresMigrations", "SecureSend.PostgresMigrations\SecureSend.PostgresMigrations.csproj", "{EBF94ECB-C3A4-4F80-8F34-31F8A82B1E81}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureSend.Test", "SecureSend.Test\SecureSend.Test.csproj", "{B83D3323-5B39-486B-9D5A-18F03D830F3C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecureSend.Test", "SecureSend.Test\SecureSend.Test.csproj", "{B83D3323-5B39-486B-9D5A-18F03D830F3C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion SecureSend/Controllers/SecureSendController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<IActionResult> ViewSecureUpload([FromBody] ViewSecureUpload qu
public async Task<FileStreamResult> DownloadFile([FromQuery] DownloadFile file, CancellationToken token)
{
var fileStream = await _sender.Send(file, token);
Response.Headers.Add("Content-Disposition", $"attachment;filename={HttpUtility.UrlEncode(fileStream.FileName)}");
Response.Headers.Append("Content-Disposition", $"attachment;filename={HttpUtility.UrlEncode(fileStream.FileName)}");
return new FileStreamResult(fileStream.FileStream, fileStream.ContentType);
}

Expand Down
83 changes: 36 additions & 47 deletions SecureSend/SecureSend.csproj
Original file line number Diff line number Diff line change
@@ -1,58 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<SpaProxyServerUrl>https://localhost:3000</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
<ImplicitUsings>enable</ImplicitUsings>

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<SpaProxyServerUrl>https://localhost:3000</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>

<Target Name="PublishVite" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />

<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ResolvedFileToPublish>
</ItemGroup>
</Target>

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishVite" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="7.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SecureSend.PostgresMigrations\SecureSend.PostgresMigrations.csproj" />
<ProjectReference Include="..\SecureSend.SqlServerMigrations\SecureSend.SqlServerMigrations.csproj" />
</ItemGroup>

</Project>
</Project>
Loading