Skip to content

Commit

Permalink
Merge pull request #25 from iblazhko/feat/net8
Browse files Browse the repository at this point in the history
feat: Migrate to .NET 8
  • Loading branch information
kevbite authored Mar 27, 2024
2 parents 102a278 + 5ed1f22 commit df4b667
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 112 deletions.
7 changes: 2 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/dotnet/.devcontainer/base.Dockerfile

# [Choice] .NET version: 5.0, 3.1, 2.1
ARG VARIANT="5.0"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:${VARIANT}
ARG SDK_VERSION="8.0"
FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION}

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends pdftk
53 changes: 8 additions & 45 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,16 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/dotnet
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "5.0",
"SDK_VERSION": "8.0",
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],

// [Optional] To reuse of your local HTTPS dev cert:
//
// 1. Export it locally using this command:
// * Windows PowerShell:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
// * macOS/Linux terminal:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
//
// 2. Uncomment these 'remoteEnv' lines:
// "remoteEnv": {
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
// },
//
// 3. Do one of the following depending on your scenario:
// * When using GitHub Codespaces and/or Remote - Containers:
// 1. Start the container
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
//
// * If only using Remote - Containers with a local container, uncomment this line instead:
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit"
]
}
}
}
34 changes: 0 additions & 34 deletions .devcontainer/library-scripts/azcli-debian.sh

This file was deleted.

18 changes: 9 additions & 9 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ jobs:
run: sudo apt-get install pdftk
- name: Install PDFtk Server CLI
if: ${{ matrix.os == 'windows-latest' }}
run: |
run: |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
choco install pdftk-server
refreshenv
echo "C:\Program Files (x86)\PDFtk Server\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v2
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- uses: actions/checkout@v4
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -44,7 +44,7 @@ jobs:
dotnet nuget push ./artifacts/*.nupkg --source NuGet.org --api-key ${{ secrets.NUGET_API_KEY }}
- name: Upload Release Asset
if: ${{ fromJSON(env.RUN_DEPLOY) }}
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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": "6.0.101",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 3 additions & 3 deletions samples/WebApplicationFillForm/WebApplicationFillForm.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>58e1799c-a4c0-41aa-9399-ac70ecee6ba2</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Kevsoft.PDFtk/Kevsoft.PDFtk.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions test/Kevsoft.PDFtk.Tests/FillFormTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task ShouldFillPdfForm_ForInputFileAsBytes()

result.Success.Should().BeTrue();
var dumpDataFields = await _pdFtk.GetDataFieldsAsync(result.Result);
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName))
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName ?? string.Empty))
.ToDictionary(x => x.FieldName!, field => field.FieldValue)
.Should()
.BeEquivalentTo(FieldData);
Expand All @@ -42,7 +42,7 @@ public async Task ShouldFillPdfForm_ForInputFileAsStream()

result.Success.Should().BeTrue();
var dumpDataFields = await _pdFtk.GetDataFieldsAsync(result.Result);
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName))
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName ?? string.Empty))
.ToDictionary(x => x.FieldName!, field => field.FieldValue)
.Should()
.BeEquivalentTo(FieldData);
Expand All @@ -55,7 +55,7 @@ public async Task ShouldFillPdfForm_ForInputFileAsFilePath()

result.Success.Should().BeTrue();
var dumpDataFields = await _pdFtk.GetDataFieldsAsync(result.Result);
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName))
dumpDataFields.Result.Where(x => FieldData.Keys.Contains(x.FieldName ?? string.Empty))
.ToDictionary(x => x.FieldName!, field => field.FieldValue)
.Should()
.BeEquivalentTo(FieldData);
Expand Down
21 changes: 10 additions & 11 deletions test/Kevsoft.PDFtk.Tests/Kevsoft.PDFtk.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>

<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Kevsoft.PDFtk\Kevsoft.PDFtk.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="TestFiles\TestFile1.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand All @@ -41,8 +44,4 @@
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Kevsoft.PDFtk\Kevsoft.PDFtk.csproj" />
</ItemGroup>

</Project>

0 comments on commit df4b667

Please sign in to comment.