Skip to content

Fix XamlCompiler test projects missing MSBuild Build target (MSB4057) - #11752

Open
Suraj Kumar Gupta (suragupta-msft) wants to merge 1 commit into
mainfrom
user/suragupta/fix-xamlcompiler-test-projects-msb4057
Open

Fix XamlCompiler test projects missing MSBuild Build target (MSB4057)#11752
Suraj Kumar Gupta (suragupta-msft) wants to merge 1 commit into
mainfrom
user/suragupta/fix-xamlcompiler-test-projects-msb4057

Conversation

@suragupta-msft

@suragupta-msft Suraj Kumar Gupta (suragupta-msft) commented Sep 1, 2026

Copy link
Copy Markdown

Summary

XamlCompiler.sln / XamlCompilerTests.sln failed with "MSB4057: The target Build does not exist in the project" because four test helper projects had no usable final .targets import.

Fix

  • LibManagedDll, LibManagedWinmd and LibManagedDllSatellite (UAP libs) now resolve the WindowsXaml C# targets by probing for an installed toolset version (v17.0 -> v16.0 -> v15.0, falling back to $(VisualStudioVersion)), so a stale hardcoded path can no longer point the import at a directory that does not exist.
  • The import is gated on Exists() and guarded by ExcludeRestorePackageImports so NuGet restore is unaffected.
  • An EnsureWindowsXamlTargetsPresent target, wired via InitialTargets, emits an actionable error when the UWP toolset is absent instead of a cryptic MSB4019/MSB4057.
  • XamlCompilerProxies (.NET Framework v4.7.2, non-UAP) imports the standard Microsoft.CSharp.targets, matching its parent harness XamlCompilerUnitTests.

XamlCompiler.sln / XamlCompilerTests.sln failed with "MSB4057: The target Build
does not exist in the project" because four test helper projects had no usable
final .targets import.

- LibManagedDll, LibManagedWinmd and LibManagedDllSatellite (UAP libs) now
  resolve the WindowsXaml C# targets by probing for an installed toolset version
  (v17.0 -> v16.0 -> v15.0, falling back to $(VisualStudioVersion)), so a stale
  hardcoded path can no longer point the import at a directory that does not
  exist.
- The import is gated on Exists() and guarded by ExcludeRestorePackageImports so
  NuGet restore is unaffected.
- An EnsureWindowsXamlTargetsPresent target, wired via InitialTargets, emits an
  actionable error when the UWP toolset is absent instead of a cryptic
  MSB4019/MSB4057.
- XamlCompilerProxies (.NET Framework v4.7.2, non-UAP) imports the standard
  Microsoft.CSharp.targets, matching its parent harness XamlCompilerUnitTests.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Sep 1, 2026
@suragupta-msft

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@suragupta-msft

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@SatwikKrSharma SatwikKrSharma 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.

I am not seeing the result of the test run in description, can you please add the test result also, on how many tests are there, how many are running and passing

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

Labels

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants