-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Stop Format redistributing MSBuild #49065
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Stop Format redistributing MSBuild #49065
Conversation
MSBuild assemblies are found via MSBuildLocator, and should never be used from the format folder--so stop droppping them there.
There was a problem hiding this 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 PR stops redistributing MSBuild assemblies by preventing the dotnet-format tool from copying unnecessary MSBuild assets and bumps the MSBuild baseline version to a patched 17.11 release.
- Updates the dotnet-format.csproj to add PackageReference elements for various Microsoft.Build packages with ExcludeAssets set to runtime, ensuring transitive dependencies do not bring MSBuild assemblies into the distribution folder.
- Bumps the MicrosoftBuildMinimumVersion in eng/Versions.props from 17.11.4 to 17.11.31 to align with the patched baseline.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/BuiltInTools/dotnet-format/dotnet-format.csproj | Added PackageReferences with proper asset exclusions to avoid redistributing MSBuild assemblies. |
eng/Versions.props | Updated MicrosoftBuildMinimumVersion to reflect the new patched MSBuild baseline. |
Comments suppressed due to low confidence (2)
src/BuiltInTools/dotnet-format/dotnet-format.csproj:39
- Ensure that excluding runtime assets for Microsoft.Build and related packages does not affect any build task behaviors in environments that may require them.
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" PrivateAssets="All" />
eng/Versions.props:202
- [nitpick] Document the rationale for updating the MicrosoftBuildMinimumVersion to 17.11.31, ensuring that maintainer instructions and release notes reflect this change.
<MicrosoftBuildMinimumVersion Condition="'$(DotNetBuildSourceOnly)' != 'true'">17.11.31</MicrosoftBuildMinimumVersion>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" /> | ||
<!-- Suppress transitive dependencies of MSBuildWorkspace on MSBuild to avoid unnecessary copies --> | ||
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" PrivateAssets="All" /> | ||
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="runtime" PrivateAssets="All" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to break this:
Build.Framework.ILogger? binlog = null; | |
if (binaryLogPath is not null) | |
{ | |
binlog = new Build.Logging.BinaryLogger() | |
{ | |
Parameters = binaryLogPath, | |
Verbosity = Build.Framework.LoggerVerbosity.Diagnostic, | |
}; | |
} |
If it's not for some reason, ExcludeAssets="compile;runtime" might be wise to ensure it's not being used by this code's compilation too.
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" /> | ||
<!-- Suppress transitive dependencies of MSBuildWorkspace on MSBuild to avoid unnecessary copies --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoeRobich Do we have a tracking bug for your work which might make this unnecessary? Or at least FYI that we can potentially revert this soon enough.
Bump MSBuild's baseline version to a patched 17.11 and stop having format drop MSBuild assemblies in its folder--they should never be used from there.