Skip to content

Fix MSB3277 “WindowsBase” conflicts in dev apps by enabling WPF build ref#5482

Merged
gladjohn merged 1 commit into
mainfrom
gladjohn/warning_fix
Sep 19, 2025
Merged

Fix MSB3277 “WindowsBase” conflicts in dev apps by enabling WPF build ref#5482
gladjohn merged 1 commit into
mainfrom
gladjohn/warning_fix

Conversation

@gladjohn

Copy link
Copy Markdown
Contributor

Fixes - Build warning

  22>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2433,5): warning MSB3277: Found conflicts between different versions of "WindowsBase" that could not be resolved. [D:\a\1\s\tests\devapps\WinFormsTestApp\WinFormsTestApp.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2433,5): warning MSB3277: There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". 

Changes proposed in this request
After recent Desktop/UI changes (and newer WebView2), several SDK‑style dev/test projects (e.g., NetCoreWinFormsWAM, the net8.0-windows target of NetFxConsoleApp) began emitting MSB3277 warnings due to a reference‑graph conflict between WindowsBase 4.0.0.0 (facade from Microsoft.NETCore.App.Ref) and WindowsBase 5.0.0.0 (required by Microsoft.Web.WebView2.Wpf.dll).

This PR resolves the conflict by enabling WPF build references in the affected SDK‑style projects so WindowsBase unifies to the desktop pack version.

Note: This does not “turn the app into a WPF UI.” It only opts the project into WPF framework references so the assembly graph is consistent. Apps remain WinForms/console unless XAML is actually added.

Testing
n/a

Performance impact
n/a

Documentation

  • All relevant documentation is updated.

@gladjohn gladjohn requested a review from a team as a code owner September 17, 2025 16:16
@gladjohn gladjohn requested a review from Copilot September 17, 2025 16:16

Copilot AI 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.

Pull Request Overview

This PR fixes MSB3277 build warnings caused by conflicts between different versions of WindowsBase assemblies (4.0.0.0 vs 5.0.0.0) in SDK-style development/test projects. The conflict arises from the interaction between Microsoft.NETCore.App.Ref and Microsoft.Web.WebView2.Wpf.dll dependencies.

  • Adds <UseWPF>true</UseWPF> property to affected SDK-style project files
  • Enables WPF build references to unify WindowsBase to the desktop pack version
  • Resolves assembly reference conflicts without changing the application UI framework

Reviewed Changes

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

File Description
tests/devapps/WinFormsTestApp/WinFormsTestApp.csproj Adds UseWPF property to resolve WindowsBase conflicts in WinForms test app
tests/devapps/WAM/NetCoreWinFormsWam/NetCoreWinFormsWAM.csproj Adds UseWPF property to resolve WindowsBase conflicts in WinForms WAM test app
tests/devapps/NetFxConsoleTestApp/NetFxConsoleApp.csproj Adds UseWPF property to resolve WindowsBase conflicts in console test app
tests/devapps/Net5TestApp/Net5TestApp.csproj Adds UseWPF property to resolve WindowsBase conflicts in Net5 test app

@trwalke trwalke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like the warnings are gone. Thanks @gladjohn

@gladjohn gladjohn merged commit e284585 into main Sep 19, 2025
11 checks passed
@gladjohn gladjohn deleted the gladjohn/warning_fix branch September 19, 2025 00:30
gladjohn added a commit that referenced this pull request Sep 29, 2025
…p.App.Ref 3.1.0 (fix CG Critical from #5482) (#5506)

Disable lockfiles for WinForms test application
This was referenced May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants