Skip to content

Commit fff24ab

Browse files
shimatclaude
andcommitted
Centralize and fix assembly versioning (#1704)
Add src/Directory.Build.props to set AssemblyVersion and FileVersion consistently across all library projects: - AssemblyVersion is pinned to 4.0.0.0 (major only). Because OpenCvSharp is a strong-named assembly, changing AssemblyVersion on every release would break .NET Framework consumers that lack binding redirects. - FileVersion is also pinned to 4.0.0.0. The date-based 4th component used in NuGet package versions (e.g. 20260530) exceeds the 65535 per-component limit of the Windows FILEVERSION PE resource, so it cannot be used directly. - InformationalVersion is left to the .NET SDK default, which sets it to the full $(Version) string including pre-release suffix and commit SHA (e.g. "4.13.0.20260530-beta+<sha>"). This is the human-readable version visible in file properties ("Product version") and most tooling, and is automatically correct whenever `dotnet pack -p:Version=...` is used. Remove the now-redundant hardcoded AssemblyVersion/FileVersion entries from OpenCvSharp.csproj, OpenCvSharp.Extensions.csproj, and OpenCvSharp.WpfExtensions.csproj. OpenCvSharp.Analyzers.csproj is intentionally unchanged; it already pins to 1.0.0.0 at the project level with an explanatory comment. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 66bd807 commit fff24ab

5 files changed

Lines changed: 29 additions & 12 deletions

File tree

docs/issue-backlog.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Check off items as they are resolved.
99

1010
## ✅ Quick wins (small, self-contained fixes)
1111

12-
### [ ] #1766 — IL3000 warning with PublishTrimmed / PublishAoT
12+
### [x] #1766 — IL3000 warning with PublishTrimmed / PublishAoT
1313

1414
- **State**: closed (stale)
1515
- **URL**: https://github.com/shimat/opencvsharp/issues/1766
@@ -23,9 +23,10 @@ Check off items as they are resolved.
2323

2424
- **State**: closed (stale)
2525
- **URL**: https://github.com/shimat/opencvsharp/issues/1704
26-
- **Root cause**: `AssemblyVersion` and `FileVersion` in the managed assemblies are not aligned with the NuGet package version, which breaks Windows Installer upgrade detection.
27-
- **Fix**: Set `<AssemblyVersion>` and `<FileVersion>` to `$(Version)` in `Directory.Build.props`.
28-
- **Effort**: Low
26+
- **Root cause**: `AssemblyVersion` and `FileVersion` were not aligned with the NuGet package version. The csproj now has them hardcoded to `4.13.0.0`, so the `0.0.0.0` symptom may already be resolved. The remaining issue is that these values must be updated manually on each release.
27+
- **Note**: Because OpenCvSharp is a strong-named assembly (`SignAssembly=true`), bumping `AssemblyVersion` on every release would be a breaking change for .NET Framework consumers (binding redirects required). The recommended approach is to keep `AssemblyVersion` pinned to the major version (e.g. `4.0.0.0`) and only align `FileVersion` / `InformationalVersion` with the NuGet package version automatically via CI.
28+
- **Fix**: Keep `AssemblyVersion` at `4.0.0.0` (major-pinned); automate `FileVersion` and `InformationalVersion` from `$(Version)` in the release pipeline.
29+
- **Effort**: Low–Medium
2930

3031
---
3132

src/Directory.Build.props

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!--
4+
AssemblyVersion is pinned to the major version (4.0.0.0) to avoid breaking
5+
strong-named binding for .NET Framework consumers. Bumping AssemblyVersion on
6+
every release would require consumers to add binding redirects in app.config,
7+
which is a breaking change.
8+
9+
FileVersion is also pinned to 4.0.0.0 because the date-based 4th component
10+
used in NuGet package versions (e.g. 4.13.0.20260530) exceeds the 65535
11+
per-component limit of the Windows FILEVERSION PE resource.
12+
13+
InformationalVersion is NOT set here; the .NET SDK automatically populates it
14+
with $(Version) (e.g. "4.13.0.20260530-beta+<commitsha>") at pack/build time,
15+
which is the human-readable version visible in file properties ("Product version")
16+
and most tooling.
17+
18+
Individual projects may override these values when they have specific requirements
19+
(e.g. OpenCvSharp.Analyzers pins to 1.0.0.0 independently).
20+
-->
21+
<AssemblyVersion>4.0.0.0</AssemblyVersion>
22+
<FileVersion>4.0.0.0</FileVersion>
23+
</PropertyGroup>
24+
</Project>

src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
2121
<RepositoryType>git</RepositoryType>
2222
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
23-
<AssemblyVersion>4.13.0.0</AssemblyVersion>
24-
<FileVersion>4.13.0.0</FileVersion>
25-
2623
<!-- NuGet Package Metadata -->
2724
<Title>OpenCvSharp GDI+ extension library.</Title>
2825
<Authors>shimat</Authors>

src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2727
<IncludeSymbols>true</IncludeSymbols>
2828
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
29-
<AssemblyVersion>4.13.0.0</AssemblyVersion>
30-
<FileVersion>4.13.0.0</FileVersion>
3129
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
3230
<PackageReadmeFile>README.managed.md</PackageReadmeFile>
3331
</PropertyGroup>

src/OpenCvSharp/OpenCvSharp.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
<RepositoryUrl>https://github.com/shimat/opencvsharp.git</RepositoryUrl>
2222
<RepositoryType>git</RepositoryType>
2323
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
24-
<AssemblyVersion>4.13.0.0</AssemblyVersion>
25-
<FileVersion>4.13.0.0</FileVersion>
26-
2724
<!-- NuGet Package Metadata -->
2825
<Title>OpenCvSharp core library. A package of separate native bindings for your OS is required.</Title>
2926
<Authors>shimat</Authors>

0 commit comments

Comments
 (0)