Skip to content

Conversation

@rainersigwald
Copy link
Member

Visual Studio 17.14 updated to newer versions of the assemblies built in https://github.com/dotnet/maintenance-packages, which caused some performance regressions related to the mismatch between MSBuild.exe and devenv.exe dependencies (AB#2359731).

We hoped to fix this by taking the same update (#11038), but that caused functional problems: applications that use MSBuildLocator to build or manipulate projects using the MSBuild API are broken by updates to some dependencies (System.Memory, as in #7873 (comment), and now System.Threading.Task.Extensions). This means that a straightforward update to those packages breaks all API consumers including users of Roslyn's MSBuildWorkspace, since the Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe shipped in current versions of Roslyn uses System.Threading.Tasks.Extensions 4.2.0.1. We backed that out in #11659 to avoid the break.

After consulting with a great group of experts (thanks @ericstj, @ViktorHofer, @AArnott!), we arrived at this design:

  • Continue building MSBuild assemblies against the same versions of the references that we did in 17.13.
  • Ship and binding-redirect to the new (matched to VS) versions of the references.

This means that

  1. an application that worked against 17.13 and is unchanged will continue working, since the assembly-level metadata that the .NET Framework assembly loader looks at is unchanged.
  2. VS and MSBuild.exe dependency versions match at runtime.
  3. VS and MSBuild.exe dependency versions are updated.
  4. An application may choose to update and binding-redirect to newer versions, which is fine because the new assemblies are what we use in VS and MSBuild.exe.

An experimental insertion (Microsoft-internal link) validates that this fixes the MethodsJitted regression caused when VS updated, causing the mismatch.

Avoids problems caused by updating references in MSBuild for core types
that are likely to be used in applications that use MSBuildLocator to
call our API: if we update our baked-in references, we will break some
of them, including Roslyn's MSBuildWorkspace BuildHost. If instead we
bake in the same references we've been using, but ship and binding
redirect to the newer versions, we can update (at runtime in normal
operation) while still being functional in older executables that
ship a stale version (and thus don't binding redirect to a new version).
Copilot AI review requested due to automatic review settings April 3, 2025 16:33
@rainersigwald rainersigwald requested a review from a team as a code owner April 3, 2025 16:33
Copy link
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.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (8)
  • eng/Packages.props: Language not supported
  • eng/Versions.props: Language not supported
  • src/Directory.Build.targets: Language not supported
  • src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj: Language not supported
  • src/MSBuild/app.amd64.config: Language not supported
  • src/MSBuild/app.config: Language not supported
  • src/Package/DevDivPackage/DevDivPackage.csproj: Language not supported
  • src/Samples/Directory.Build.props: Language not supported

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

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

Nothing blocking, just questions.

@rainersigwald rainersigwald enabled auto-merge (squash) April 3, 2025 21:12
@rainersigwald rainersigwald merged commit 9d322cd into dotnet:vs17.14 Apr 4, 2025
10 checks passed
@rainersigwald rainersigwald deleted the exp/maintenance-packages-but-lies branch April 4, 2025 13:38
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.

6 participants