Skip to content

Centralize and fix assembly versioning - #1885

Merged
shimat merged 2 commits into
mainfrom
fix/1704-assembly-version
May 30, 2026
Merged

Centralize and fix assembly versioning#1885
shimat merged 2 commits into
mainfrom
fix/1704-assembly-version

Conversation

@shimat

@shimat shimat commented May 30, 2026

Copy link
Copy Markdown
Owner

Fixes #1704

Problem

AssemblyVersion and FileVersion were hardcoded to 4.13.0.0 in each library project individually, and were not updated automatically at release time. Simply syncing them to the NuGet package version is not safe either: the date-based 4th component (e.g. 20260530) exceeds the 65535 per-component limit of the Windows FILEVERSION PE resource, and bumping AssemblyVersion on every release is a breaking change for .NET Framework consumers of a strong-named assembly (binding redirects would be required).

Changes

Add src/Directory.Build.props to define assembly versioning policy in one place:

  • AssemblyVersion4.0.0.0 (major-pinned). Strong-named assemblies should keep AssemblyVersion stable across minor/patch releases. .NET Framework consumers bind to this value; changing it forces app.config binding redirects.

  • FileVersion4.0.0.0 (pinned). The date-based 4th component (e.g. 20260530) exceeds 65535, the Windows FILEVERSION resource limit, so it cannot be used directly.

  • InformationalVersion — not set here; the .NET SDK automatically populates it with the full $(Version) string including the pre-release suffix and commit SHA (e.g. 4.13.0.20260530-beta+<sha>). This is the human-readable version visible in Windows file properties ("Product version") and is automatically correct whenever dotnet pack -p:Version=... is used in CI.

Remove the now-redundant hardcoded AssemblyVersion/FileVersion entries from OpenCvSharp.csproj, OpenCvSharp.Extensions.csproj, and OpenCvSharp.WpfExtensions.csproj.

OpenCvSharp.Analyzers.csproj is intentionally left unchanged; it already pins to 1.0.0.0 at the project level with an explanatory comment.

Summary by CodeRabbit

  • Chores
    • Centralized assembly/versioning defaults so projects inherit consistent AssemblyVersion/FileVersion pinned to 4.0.0.0 and per-project explicit values removed.
  • Documentation
    • Updated issue backlog: marked the IL3000 quick-win resolved and rewrote versioning guidance to recommend major-pinned AssemblyVersion/FileVersion while automating InformationalVersion; effort estimate updated.

Review Change Stack

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>
@shimat shimat self-assigned this May 30, 2026
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3621825c-03de-46fb-8612-7cdca7cb1f65

📥 Commits

Reviewing files that changed from the base of the PR and between fff24ab and df63394.

📒 Files selected for processing (1)
  • docs/issue-backlog.md
✅ Files skipped from review due to trivial changes (1)
  • docs/issue-backlog.md

📝 Walkthrough

Walkthrough

This PR consolidates assembly version metadata management across the OpenCVSharp repository. A new Directory.Build.props file centralizes AssemblyVersion and FileVersion pinning to 4.0.0.0, and three project files remove explicit version declarations to inherit the shared defaults. The issue backlog is updated to record the resolution.

Changes

Assembly Version Metadata Centralization

Layer / File(s) Summary
Issue resolution and version strategy documentation
docs/issue-backlog.md
Issue #1704 is updated with root-cause analysis and solution details: AssemblyVersion pinned to 4.0.0.0, FileVersion/InformationalVersion to be automated from the release pipeline. Issue #1766 is marked resolved.
Repository-wide version defaults
src/Directory.Build.props
New Directory.Build.props establishes repo-wide MSBuild defaults: AssemblyVersion and FileVersion pinned to 4.0.0.0, with comments explaining SDK handling of InformationalVersion and Windows FILEVERSION limits.
Project-level version metadata cleanup
src/OpenCvSharp/OpenCvSharp.csproj, src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj, src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj
Explicit <AssemblyVersion> and <FileVersion> properties (all previously 4.13.0.0) are removed from three project files, allowing them to inherit centralized defaults from Directory.Build.props.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: centralizing and fixing assembly versioning across the codebase.
Linked Issues check ✅ Passed The PR successfully addresses issue #1704 by centralizing assembly and file versioning via Directory.Build.props, fixing the Windows FILEVERSION limits issue.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #1704: documentation updates, centralized versioning configuration, and removal of redundant version declarations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1704-assembly-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/issue-backlog.md`:
- Around line 26-29: Update the documentation sentence that says "automate
FileVersion and InformationalVersion from $(Version) in the release pipeline" to
state that FileVersion is intentionally pinned to 4.0.0.0 in
Directory.Build.props (due to Windows PE/FILEVERSION 65535-per-component limits
and the project comment in Directory.Build.props), while InformationalVersion
remains automated from $(Version) by the SDK; keep the recommended approach to
pin AssemblyVersion to the major (e.g., 4.0.0.0) and automate only
InformationalVersion in CI.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7547e1e7-41f0-47ea-8900-7950bef99e08

📥 Commits

Reviewing files that changed from the base of the PR and between aee67d6 and fff24ab.

📒 Files selected for processing (5)
  • docs/issue-backlog.md
  • src/Directory.Build.props
  • src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj
  • src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj
  • src/OpenCvSharp/OpenCvSharp.csproj
💤 Files with no reviewable changes (3)
  • src/OpenCvSharp/OpenCvSharp.csproj
  • src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj
  • src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj

Comment thread docs/issue-backlog.md
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • docs/issue-backlog.md

Commit: df63394cfb02f7e8ae2a4e8ac7e422c0210db4e3

The changes have been pushed to the fix/1704-assembly-version branch.

Time taken: 1m 49s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@shimat
shimat merged commit ab62a9d into main May 30, 2026
10 checks passed
@shimat
shimat deleted the fix/1704-assembly-version branch May 30, 2026 11:52
@shimat shimat added the bug Confirmed defect in OpenCvSharp label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed defect in OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCVSharp dlls (assembly) versions are incorrect

1 participant