Skip to content

fix: demote MSB3277 and add binding redirects#182

Open
alafleur-genetec wants to merge 3 commits into
mainfrom
fix/auto-generate-binding-redirects
Open

fix: demote MSB3277 and add binding redirects#182
alafleur-genetec wants to merge 3 commits into
mainfrom
fix/auto-generate-binding-redirects

Conversation

@alafleur-genetec
Copy link
Copy Markdown
Member

@alafleur-genetec alafleur-genetec commented May 15, 2026

Summary

  • Demote MSB3277 from warning to message for the sample projects, so expected SDK dependency version drift does not drown out real build issues.
  • Enable automatic binding redirects for net481 executable samples so .NET Framework apps resolve those dependency versions at runtime.
  • Keep binding redirect generation scoped to executable outputs; Plugin and Workspace class libraries remain governed by their host process configuration.
  • Use the conventional Directory.Build.props / Directory.Build.targets casing and update the solution items to match.

The build log was showing ~6000 instances of MSB3277 ("Found conflicts
between different versions of the same dependent assembly") across the
solution. The drift is real — the Genetec SDK assemblies pull in modern
transitive packages (System.DirectoryServices.Protocols,
System.ServiceModel.*, Microsoft.Identity.*, etc) that don't match the
versions referenced by the sample projects.

Two changes in Directory.build.props:

- AutoGenerateBindingRedirects + GenerateBindingRedirectsOutputType for
  net481 projects. Resolves the version drift at runtime so .NET Framework
  builds load the higher version of each conflicting assembly. Fixes a
  latent runtime-safety issue. Auto-generated *.exe.config / *.dll.config
  files go to bin/ which is already gitignored.

- MSBuildWarningsAsMessages MSB3277 (global). Demotes the build-time
  warning to a message across both target frameworks. The warning fires
  during MSBuild reference resolution, before runtime redirects apply,
  so binding redirects alone do not silence it. .NET 8 doesn't use
  binding redirects (different load context model) but the warning
  fires there too — global suppression covers both.

Verified locally: warning count for MSB3277 drops from 5982 to 0.
Other warning categories unchanged.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Samples-wide MSBuild props to reduce build noise from expected assembly-version conflicts and improve .NET Framework runtime assembly resolution behavior.

Changes:

  • Demotes MSB3277 (“dependency conflicts”) from warning to message for all sample target frameworks.
  • Enables automatic binding-redirect generation for net481 sample builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Samples/Directory.Build.props
Comment thread Samples/Directory.build.props Outdated
- Rename Directory.build.props -> Directory.Build.props (and .targets).
  MSBuild's convention-based import looks for the canonical capital-B
  name. Lowercase works on case-insensitive filesystems (Windows) but
  may not be picked up on Linux, which would silently disable both the
  MSB3277 demotion and the binding-redirect generation.

- Remove GenerateBindingRedirectsOutputType. Binding redirects only
  affect entry-point app configs; for class libraries (Plugin / Workspace
  SDK samples) the host process's config governs assembly resolution,
  so the .dll.config the property would generate is ineffective. Default
  AutoGenerateBindingRedirects behavior already scopes correctly to Exe
  outputs without this flag.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

Comment thread Samples/Directory.Build.props
Followup to 16c04e2 — the .sln Solution Items section still pointed at
the lowercase Directory.build.props / Directory.build.targets, which on
case-sensitive filesystems would fail to resolve to the renamed files.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment thread Samples/Directory.Build.props
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

@alafleur-genetec alafleur-genetec changed the title fix: silence MSB3277 noise and add binding redirects on .NET Framework fix: demote MSB3277 and add binding redirects May 16, 2026
@alafleur-genetec alafleur-genetec requested a review from Copilot May 16, 2026 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants