fix: demote MSB3277 and add binding redirects#182
Open
alafleur-genetec wants to merge 3 commits into
Open
Conversation
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.
Contributor
There was a problem hiding this comment.
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
net481sample builds.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MSB3277from warning to message for the sample projects, so expected SDK dependency version drift does not drown out real build issues.net481executable samples so .NET Framework apps resolve those dependency versions at runtime.Directory.Build.props/Directory.Build.targetscasing and update the solution items to match.