Skip to content

Commit 3597d47

Browse files
authored
Merge pull request #90 from forcewake/codex/review-and-update-.net-project
2 parents 20004b3 + 252e4b0 commit 3597d47

21 files changed

Lines changed: 760 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main, dev ]
6+
pull_request:
7+
8+
jobs:
9+
build-dotnet8:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup .NET SDK
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: 8.0.x
19+
20+
- name: Build modern SDK-style projects (v2)
21+
run: |
22+
dotnet build src/FlatFile.Core.Modern/FlatFile.Core.Modern.csproj -c Release
23+
dotnet build src/FlatFile.Core.Attributes.Modern/FlatFile.Core.Attributes.Modern.csproj -c Release
24+
dotnet build src/FlatFile.Delimited.Modern/FlatFile.Delimited.Modern.csproj -c Release
25+
dotnet build src/FlatFile.FixedLength.Modern/FlatFile.FixedLength.Modern.csproj -c Release
26+
dotnet build src/FlatFile.Delimited.Attributes.Modern/FlatFile.Delimited.Attributes.Modern.csproj -c Release
27+
dotnet build src/FlatFile.FixedLength.Attributes.Modern/FlatFile.FixedLength.Attributes.Modern.csproj -c Release
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish NuGet (v2)
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
env:
15+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
16+
PACKAGE_VERSION: 2.0.${{ github.run_number }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup .NET SDK
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: 8.0.x
25+
26+
- name: Validate NuGet API key is configured
27+
run: |
28+
if [ -z "$NUGET_API_KEY" ]; then
29+
echo "NUGET_API_KEY secret is not configured." >&2
30+
exit 1
31+
fi
32+
33+
- name: Pack v2 packages
34+
run: |
35+
mkdir -p artifacts/packages
36+
dotnet pack src/FlatFile.Core.Modern/FlatFile.Core.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
37+
dotnet pack src/FlatFile.Core.Attributes.Modern/FlatFile.Core.Attributes.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
38+
dotnet pack src/FlatFile.Delimited.Modern/FlatFile.Delimited.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
39+
dotnet pack src/FlatFile.FixedLength.Modern/FlatFile.FixedLength.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
40+
dotnet pack src/FlatFile.Delimited.Attributes.Modern/FlatFile.Delimited.Attributes.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
41+
dotnet pack src/FlatFile.FixedLength.Attributes.Modern/FlatFile.FixedLength.Attributes.Modern.csproj -c Release -o artifacts/packages /p:Version=$PACKAGE_VERSION
42+
43+
- name: Publish packages to NuGet
44+
run: |
45+
dotnet nuget push "artifacts/packages/*.nupkg" \
46+
--api-key "$NUGET_API_KEY" \
47+
--source https://api.nuget.org/v3/index.json \
48+
--skip-duplicate

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ FlatFile
44

55
FlatFile is a library to work with flat files (work up-to 100 times faster then [FileHelpers](https://www.nuget.org/packages/FileHelpers/2.0.0))
66

7+
8+
## Modernization status
9+
10+
- 🚨 **v2 breaking change**: dropped legacy .NET Framework targets (`net35`-`net48`) and old build pipeline.
11+
- ✅ Modernized runtime support to **.NET 8** only via SDK-style projects.
12+
- ✅ CI now builds modern projects with `dotnet build` on GitHub Actions.
13+
14+
### Modern .NET support
15+
16+
Active projects:
17+
18+
- `src/FlatFile.Core.Modern`
19+
- `src/FlatFile.Core.Attributes.Modern`
20+
- `src/FlatFile.Delimited.Modern`
21+
- `src/FlatFile.FixedLength.Modern`
22+
- `src/FlatFile.Delimited.Attributes.Modern`
23+
- `src/FlatFile.FixedLength.Attributes.Modern`
24+
25+
All of them target `net8.0` and carry package/assembly version `2.0.0`.
26+
27+
### NuGet publishing from GitHub
28+
29+
When changes are merged to `master`, GitHub Actions can publish v2 packages automatically using `.github/workflows/publish-nuget.yml`.
30+
31+
Required repository secret:
32+
33+
- `NUGET_API_KEY`: NuGet.org API key with push permission for FlatFile packages.
34+
35+
The publish workflow packs all `*.Modern` projects and pushes resulting `.nupkg` files to NuGet (`--skip-duplicate`).
36+
737
### Installing FlatFile
838

939
#### Installing all packages

assets/psake-common.ps1

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,43 @@ Properties {
2020
### Project information
2121
$solution_path = "$src_dir\$solution"
2222
$sharedAssemblyInfo = "$src_dir\SharedAssemblyInfo.cs"
23-
$config = "Release"
24-
$frameworks = @("NET35", "NET40", "NET45")
23+
$config = "Release"
24+
$modern_projects = @(
25+
"$src_dir\FlatFile.Core.Modern\FlatFile.Core.Modern.csproj",
26+
"$src_dir\FlatFile.Core.Attributes.Modern\FlatFile.Core.Attributes.Modern.csproj",
27+
"$src_dir\FlatFile.Delimited.Modern\FlatFile.Delimited.Modern.csproj",
28+
"$src_dir\FlatFile.FixedLength.Modern\FlatFile.FixedLength.Modern.csproj",
29+
"$src_dir\FlatFile.Delimited.Attributes.Modern\FlatFile.Delimited.Attributes.Modern.csproj",
30+
"$src_dir\FlatFile.FixedLength.Attributes.Modern\FlatFile.FixedLength.Attributes.Modern.csproj"
31+
)
2532

2633
### Files
2734
$releaseNotes = "$base_dir\ChangeLog.md"
2835
}
2936

3037
## Tasks
3138

32-
Task Restore -Description "Restore NuGet packages for solution." {
33-
"Restoring NuGet packages for '$solution_path'..."
34-
Exec { .$nuget restore $solution_path }
39+
Task Restore -Description "Restore .NET packages for modern projects." {
40+
foreach ($project in $modern_projects) {
41+
"Restoring '$project'..."
42+
Exec { dotnet restore $project }
43+
}
3544
}
3645

3746
Task Clean -Description "Clean up build and project folders." {
3847
Clean-Directory $build_dir
3948

40-
if ($solution) {
41-
"Cleaning up '$solution'..."
42-
43-
foreach ($framework in $frameworks) {
44-
Exec { msbuild $solution_path /target:Clean /nologo /verbosity:minimal /p:Framework=$framework}
45-
}
49+
foreach ($project in $modern_projects) {
50+
"Cleaning '$project'..."
51+
Exec { dotnet clean $project -c $config }
4652
}
4753
}
4854

49-
Task Compile -Depends Clean, Restore -Description "Compile all the projects in a solution." {
50-
"Compiling '$solution'..."
51-
52-
$extra = $null
53-
if ($appVeyor) {
54-
$extra = "/logger:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
55+
Task Compile -Depends Clean, Restore -Description "Compile all modern SDK-style projects." {
56+
foreach ($project in $modern_projects) {
57+
"Compiling '$project'..."
58+
Exec { dotnet build $project -c $config --no-restore }
5559
}
56-
57-
foreach ($framework in $frameworks) {
58-
Exec { msbuild $solution_path /p:"Configuration=$config;Framework=$framework" /nologo /verbosity:minimal $extra }
59-
}
6060
}
6161

6262
### Pack functions

docs/modernization-plan.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# FlatFile modernization plan
2+
3+
## Current direction (v2)
4+
5+
This repository now follows a **modern-only** strategy:
6+
7+
1. Legacy .NET Framework build matrix was removed from CI.
8+
2. SDK-style projects under `*.Modern` are the active build path.
9+
3. Active target is `net8.0` with version `2.0.0` (breaking major release).
10+
11+
## Why
12+
13+
The previous mixed strategy (legacy + modern) produced unstable CI and unnecessary maintenance overhead.
14+
A major-version reset enables simpler tooling, faster builds, and a clear support policy.
15+
16+
## Next steps
17+
18+
- Publish v2 packages from modern projects (`dotnet pack`).
19+
- Add analyzers and nullable annotations incrementally.
20+
- Add dedicated test projects targeting `net8.0`.
21+
22+
23+
## CI/CD publishing
24+
25+
- `.github/workflows/publish-nuget.yml` publishes NuGet packages on pushes to `master`.
26+
- Configure repository secret `NUGET_API_KEY` before enabling release merges.
27+
- Package versions are generated as `2.0.<run_number>` in CI.

src/Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<PropertyGroup Condition="$([System.String]::Copy('$(MSBuildProjectName)').Contains('.Modern'))">
3+
<IsPackable>true</IsPackable>
4+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
5+
<Authors>forcewake</Authors>
6+
<Company>Pavel Nasovich</Company>
7+
<Description>FlatFile library for high-performance fixed-length and delimited file processing.</Description>
8+
<PackageProjectUrl>https://github.com/forcewake/FlatFile</PackageProjectUrl>
9+
<RepositoryUrl>https://github.com/forcewake/FlatFile</RepositoryUrl>
10+
<RepositoryType>git</RepositoryType>
11+
<PackageReadmeFile>README.md</PackageReadmeFile>
12+
</PropertyGroup>
13+
14+
<ItemGroup Condition="$([System.String]::Copy('$(MSBuildProjectName)').Contains('.Modern'))">
15+
<None Include="$(MSBuildThisFileDirectory)..\README.md" Pack="true" PackagePath="\" Link="README.md" />
16+
</ItemGroup>
17+
</Project>

src/FlatFile.Benchmark/FlatFile.Benchmark.csproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,63 @@
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>
3333
</PropertyGroup>
34+
35+
36+
<PropertyGroup Condition=" '$(Framework)' == 'NET451' ">
37+
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
38+
<PlatformTarget>AnyCPU</PlatformTarget>
39+
</PropertyGroup>
40+
<PropertyGroup Condition=" '$(Framework)' == 'NET452' ">
41+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
42+
<PlatformTarget>AnyCPU</PlatformTarget>
43+
</PropertyGroup>
44+
<PropertyGroup Condition=" '$(Framework)' == 'NET46' ">
45+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
46+
<PlatformTarget>AnyCPU</PlatformTarget>
47+
</PropertyGroup>
48+
<PropertyGroup Condition=" '$(Framework)' == 'NET461' ">
49+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
50+
<PlatformTarget>AnyCPU</PlatformTarget>
51+
</PropertyGroup>
52+
<PropertyGroup Condition=" '$(Framework)' == 'NET462' ">
53+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
54+
<PlatformTarget>AnyCPU</PlatformTarget>
55+
</PropertyGroup>
56+
<PropertyGroup Condition=" '$(Framework)' == 'NET47' ">
57+
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
58+
<PlatformTarget>AnyCPU</PlatformTarget>
59+
</PropertyGroup>
60+
<PropertyGroup Condition=" '$(Framework)' == 'NET471' ">
61+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
62+
<PlatformTarget>AnyCPU</PlatformTarget>
63+
</PropertyGroup>
64+
<PropertyGroup Condition=" '$(Framework)' == 'NET472' ">
65+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
66+
<PlatformTarget>AnyCPU</PlatformTarget>
67+
</PropertyGroup>
68+
<PropertyGroup Condition=" '$(Framework)' == 'NET48' And '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
69+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
70+
<PlatformTarget>AnyCPU</PlatformTarget>
71+
<DebugSymbols>true</DebugSymbols>
72+
<DebugType>full</DebugType>
73+
<Optimize>false</Optimize>
74+
<OutputPath>bin\$(Configuration)\$(Framework)\</OutputPath>
75+
<DefineConstants>DEBUG;TRACE</DefineConstants>
76+
<ErrorReport>prompt</ErrorReport>
77+
<WarningLevel>4</WarningLevel>
78+
</PropertyGroup>
79+
<PropertyGroup Condition=" '$(Framework)' == 'NET48' And '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
80+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
81+
<PlatformTarget>AnyCPU</PlatformTarget>
82+
<DebugType>pdbonly</DebugType>
83+
<Optimize>true</Optimize>
84+
<OutputPath>bin\$(Configuration)\$(Framework)\</OutputPath>
85+
<DefineConstants>TRACE</DefineConstants>
86+
<ErrorReport>prompt</ErrorReport>
87+
<WarningLevel>4</WarningLevel>
88+
<DocumentationFile>bin\$(Configuration)\$(Framework)\FlatFile.Benchmark.XML</DocumentationFile>
89+
</PropertyGroup>
90+
3491
<ItemGroup>
3592
<Reference Include="BenchmarkIt">
3693
<HintPath>..\packages\Benchmark.It.1.2.0\lib\BenchmarkIt.dll</HintPath>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<RootNamespace>FlatFile.Core.Attributes</RootNamespace>
5+
<AssemblyName>FlatFile.Core.Attributes</AssemblyName>
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<LangVersion>latest</LangVersion>
8+
<Nullable>disable</Nullable>
9+
<Deterministic>true</Deterministic>
10+
<Version>2.0.0</Version>
11+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
12+
<FileVersion>2.0.0.0</FileVersion>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<Compile Include="../FlatFile.Core.Attributes/**/*.cs" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="../FlatFile.Core.Modern/FlatFile.Core.Modern.csproj" />
21+
</ItemGroup>
22+
</Project>

src/FlatFile.Core.Attributes/FlatFile.Core.Attributes.csproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,63 @@
8686
<WarningLevel>4</WarningLevel>
8787
<DocumentationFile>bin\$(Configuration)\$(Framework)\$(AssemblyName).XML</DocumentationFile>
8888
</PropertyGroup>
89+
90+
91+
<PropertyGroup Condition=" '$(Framework)' == 'NET451' ">
92+
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
93+
<PlatformTarget>AnyCPU</PlatformTarget>
94+
</PropertyGroup>
95+
<PropertyGroup Condition=" '$(Framework)' == 'NET452' ">
96+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
97+
<PlatformTarget>AnyCPU</PlatformTarget>
98+
</PropertyGroup>
99+
<PropertyGroup Condition=" '$(Framework)' == 'NET46' ">
100+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
101+
<PlatformTarget>AnyCPU</PlatformTarget>
102+
</PropertyGroup>
103+
<PropertyGroup Condition=" '$(Framework)' == 'NET461' ">
104+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
105+
<PlatformTarget>AnyCPU</PlatformTarget>
106+
</PropertyGroup>
107+
<PropertyGroup Condition=" '$(Framework)' == 'NET462' ">
108+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
109+
<PlatformTarget>AnyCPU</PlatformTarget>
110+
</PropertyGroup>
111+
<PropertyGroup Condition=" '$(Framework)' == 'NET47' ">
112+
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
113+
<PlatformTarget>AnyCPU</PlatformTarget>
114+
</PropertyGroup>
115+
<PropertyGroup Condition=" '$(Framework)' == 'NET471' ">
116+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
117+
<PlatformTarget>AnyCPU</PlatformTarget>
118+
</PropertyGroup>
119+
<PropertyGroup Condition=" '$(Framework)' == 'NET472' ">
120+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
121+
<PlatformTarget>AnyCPU</PlatformTarget>
122+
</PropertyGroup>
123+
<PropertyGroup Condition=" '$(Framework)' == 'NET48' And '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
124+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
125+
<PlatformTarget>AnyCPU</PlatformTarget>
126+
<DebugSymbols>true</DebugSymbols>
127+
<DebugType>full</DebugType>
128+
<Optimize>false</Optimize>
129+
<OutputPath>bin\$(Configuration)\$(Framework)\</OutputPath>
130+
<DefineConstants>DEBUG;TRACE</DefineConstants>
131+
<ErrorReport>prompt</ErrorReport>
132+
<WarningLevel>4</WarningLevel>
133+
</PropertyGroup>
134+
<PropertyGroup Condition=" '$(Framework)' == 'NET48' And '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
135+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
136+
<PlatformTarget>AnyCPU</PlatformTarget>
137+
<DebugType>pdbonly</DebugType>
138+
<Optimize>true</Optimize>
139+
<OutputPath>bin\$(Configuration)\$(Framework)\</OutputPath>
140+
<DefineConstants>TRACE</DefineConstants>
141+
<ErrorReport>prompt</ErrorReport>
142+
<WarningLevel>4</WarningLevel>
143+
<DocumentationFile>bin\$(Configuration)\$(Framework)\FlatFile.Core.Attributes.XML</DocumentationFile>
144+
</PropertyGroup>
145+
89146
<ItemGroup>
90147
<Reference Include="System" />
91148
<Reference Include="System.Core" />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<RootNamespace>FlatFile.Core</RootNamespace>
5+
<AssemblyName>FlatFile.Core</AssemblyName>
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<LangVersion>latest</LangVersion>
8+
<Nullable>disable</Nullable>
9+
<Deterministic>true</Deterministic>
10+
<Version>2.0.0</Version>
11+
<AssemblyVersion>2.0.0.0</AssemblyVersion>
12+
<FileVersion>2.0.0.0</FileVersion>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<Compile Include="../FlatFile.Core/**/*.cs" />
17+
</ItemGroup>
18+
</Project>

0 commit comments

Comments
 (0)