Skip to content

Port #52743 to release/10.0.3xx: Remove ResolverTargetFramework and ToolsetTargetFramework aliases - #53309

Merged
marcpopMSFT merged 3 commits into
release/10.0.3xxfrom
copilot/port-pull52743-to-release-10-0-3xx
Mar 25, 2026
Merged

Port #52743 to release/10.0.3xx: Remove ResolverTargetFramework and ToolsetTargetFramework aliases#53309
marcpopMSFT merged 3 commits into
release/10.0.3xxfrom
copilot/port-pull52743-to-release-10-0-3xx

Conversation

CopilotAI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor
  • Remove ToolsetTargetFramework and ResolverTargetFramework property definitions from Directory.Build.props
  • Replace $(ResolverTargetFramework) with $(SdkTargetFramework) in resolver/library project files
  • Replace $(ToolsetTargetFramework) with $(SdkTargetFramework) in test project files (27 files)
  • Replace #if NET472 / #if NET472_OR_GREATER with #if NETFRAMEWORK in source files
  • Rename src/Containers/Microsoft.NET.Build.Containers/net472Definitions.cs to netframeworkDefinitions.cs
  • Update Microsoft.NET.Build.Containers.csproj to reference the renamed file (netframeworkDefinitions.cs) in both Include and Remove items
  • Update comments in Crossgen.targets and StaticWebAsset.cs

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

CopilotAI changed the title [WIP] Port changes from PR #52743 to release/10.0.3xxPort #52743 to release/10.0.3xx: Remove ResolverTargetFramework and ToolsetTargetFramework aliasesMar 6, 2026
@marcpopMSFT

Copy link
Copy Markdown
Member

@copilot fix the build breaks:

  • ##[error]CSC(0,0): error CS2001: (NETCORE_ENGINEERING_TELEMETRY=Build) Source file 'D:\a_work\1\s\src\Containers\Microsoft.NET.Build.Containers\net472Definitions.cs' could not be found.
  • ##[error]src\Containers\Microsoft.NET.Build.Containers\Tasks\CreateNewImage.cs(275,34): error CS8629: (NETCORE_ENGINEERING_TELEMETRY=Build) Nullable value type may be null.
  • ##[error]src\Containers\Microsoft.NET.Build.Containers\ImageConfig.cs(243,31): error CS8629: (NETCORE_ENGINEERING_TELEMETRY=Build) Nullable value type may be null.
  • ##[error]src\Containers\Microsoft.NET.Build.Containers\AuthHandshakeMessageHandler.cs(406,69): error CS8604: (NETCORE_ENGINEERING_TELEMETRY=Build) Possible null reference argument for parameter 'scheme' in 'Task<(AuthenticationHeaderValue, DateTimeOffset)?> AuthHandshakeMessageHandler.GetAuthenticationAsync(string registry, string scheme, AuthInfo? bearerAuthInfo, CancellationToken cancellationToken)'.

CopilotAI commented Mar 6, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot fix the build breaks:

  • ##[error]CSC(0,0): error CS2001: (NETCORE_ENGINEERING_TELEMETRY=Build) Source file 'D:\a_work\1\s\src\Containers\Microsoft.NET.Build.Containers\n...

Fixed in c4e7e7e. When net472Definitions.cs was renamed to netframeworkDefinitions.cs, the project file still had explicit <Compile Include="net472Definitions.cs" /> and <Compile Remove="net472Definitions.cs" /> entries. This caused:

  • CS2001: The net472 build couldn't find the (now renamed) file
  • CS8629/CS8604: Since the Remove rule no longer matched the renamed file, netframeworkDefinitions.cs was being compiled in the net10.0 build too, which defined NotNullWhenAttribute in the Microsoft.NET.Build.Containers namespace — shadowing the System.Diagnostics.CodeAnalysis.NotNullWhenAttribute that the compiler relies on for null flow analysis

Updated both references in the project file to use netframeworkDefinitions.cs.

CopilotAIand others added 2 commits March 16, 2026 15:58
…work, use SdkTargetFramework directly
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
…d netframeworkDefinitions.cs
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
@marcpopMSFT
marcpopMSFT marked this pull request as ready for review March 16, 2026 22:58
@marcpopMSFT
marcpopMSFT requested review from a team, tmat and vijayrkn as code ownersMarch 16, 2026 22:58
CopilotAI review requested due to automatic review settings March 16, 2026 22:58
@marcpopMSFT
marcpopMSFTforce-pushed the copilot/port-pull52743-to-release-10-0-3xx branch from c4e7e7e to 95cd079CompareMarch 16, 2026 22:58

CopilotAI 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

Ports the main-branch change to the release/10.0.3xx line by removing the ToolsetTargetFramework / ResolverTargetFramework aliases and standardizing on $(SdkTargetFramework), while also normalizing .NET Framework conditional compilation to NETFRAMEWORK.

Changes:

  • Remove ToolsetTargetFramework and ResolverTargetFramework from Directory.Build.props and update all affected .csproj files to use $(SdkTargetFramework).
  • Replace #if NET472 / #if NET472_OR_GREATER with #if NETFRAMEWORK in relevant source files.
  • Rename the Containers net472-only definitions file and update project includes/removes accordingly, plus a couple comment updates.

Reviewed changes

Copilot reviewed 48 out of 49 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
test/trustedroots.Tests/trustedroots.Tests.csprojSwitch test TFM from $(ToolsetTargetFramework) to $(SdkTargetFramework).
test/sdk-tasks.Tests/sdk-tasks.Tests.csprojReplace $(ToolsetTargetFramework) usages in multi-targeting and conditional OutputType.
test/msbuild.Integration.Tests/msbuild.Integration.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/dotnet.Tests/dotnet.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/dotnet-watch.Tests/dotnet-watch.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/dotnet-watch-test-browser/dotnet-watch-test-browser.csprojSwitch test TFM to $(SdkTargetFramework).
test/dotnet-new.IntegrationTests/dotnet-new.IntegrationTests.csprojSwitch test TFM to $(SdkTargetFramework).
test/SDDLTests/SDDLTests.csprojSwitch test TFM(s) to $(SdkTargetFramework).
test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csprojSwitch test TFM to $(SdkTargetFramework).
test/Microsoft.Win32.Msi.Tests/Microsoft.Win32.Msi.Tests.csprojSwitch test TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.Win32.Msi.Manual.Tests/Microsoft.Win32.Msi.Manual.Tests.csprojSwitch manual test TFM(s) to $(SdkTargetFramework).
test/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/Microsoft.NET.Sdk.WorkloadManifestReader.Tests.csprojSwitch test TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Microsoft.NET.Sdk.Publish.Tasks.Tests.csprojSwitch test TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.Tools.Tests.ComponentMocks/Microsoft.DotNet.Tools.Tests.ComponentMocks.csprojSwitch test TFM to $(SdkTargetFramework).
test/Microsoft.DotNet.TemplateLocator.Tests/Microsoft.DotNet.TemplateLocator.Tests.csprojSwitch test TFM(s) + build-pass conditional to $(SdkTargetFramework).
test/Microsoft.DotNet.PackageValidation.Tests/Microsoft.DotNet.PackageValidation.Tests.csprojSwitch TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/Microsoft.DotNet.GenAPI.Tests/Microsoft.DotNet.GenAPI.Tests.csprojSwitch test TFM and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/Microsoft.DotNet.ApiSymbolExtensions.Tests/Microsoft.DotNet.ApiSymbolExtensions.Tests.csprojSwitch TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.ApiDiff.Tests/Microsoft.DotNet.ApiDiff.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/Microsoft.DotNet.ApiCompatibility.Tests/Microsoft.DotNet.ApiCompatibility.Tests.csprojSwitch TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.ApiCompat.Tests/Microsoft.DotNet.ApiCompat.Tests.csprojSwitch TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/Microsoft.DotNet.ApiCompat.IntegrationTests/Microsoft.DotNet.ApiCompat.IntegrationTests.csprojSwitch TFM(s) and conditional OutputType to $(SdkTargetFramework).
test/EndToEnd.Tests/EndToEnd.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
test/ArgumentsReflector/ArgumentsReflector.csprojSwitch test utility TFM to $(SdkTargetFramework).
test/ArgumentForwarding.Tests/ArgumentForwarding.Tests.csprojSwitch test TFM to $(SdkTargetFramework).
src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/Tasks/MsDeploy/MSDeploy.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/Tasks/MsDeploy/CreateParameterFile.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/Tasks/MsDeploy/CreateManifestFile.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/MsDeploy/VsMSDeployObject.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/MsDeploy/DynamicAssembly.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/WebSdk/Publish/Tasks/MsDeploy/CommonUtility.csNormalize preprocessor checks from NET472 to NETFRAMEWORK.
src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointResponseHeader.csNormalize GetHashCode conditional compilation to NETFRAMEWORK.
src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointProperty.csNormalize GetHashCode conditional compilation to NETFRAMEWORK.
src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpoint.csNormalize GetHashCode conditional compilation to NETFRAMEWORK.
src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.csUpdate comment to reference “.NET Framework” rather than “.net472”.
src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/Microsoft.NET.Sdk.WorkloadManifestReader.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework).
src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework).
src/Resolvers/Microsoft.DotNet.SdkResolver/Microsoft.DotNet.SdkResolver.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework) (including build-pass conditional).
src/Resolvers/Microsoft.DotNet.NativeWrapper/Microsoft.DotNet.NativeWrapper.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework).
src/Microsoft.DotNet.TemplateLocator/Microsoft.DotNet.TemplateLocator.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework) (including build-pass conditional).
src/Layout/redist/targets/Crossgen.targetsUpdate comment referencing net472 to netframework terminology.
src/Containers/Microsoft.NET.Build.Containers/netframeworkDefinitions.csAdd renamed netframework definitions/polyfills file.
src/Containers/Microsoft.NET.Build.Containers/Microsoft.NET.Build.Containers.csprojUpdate compile include/remove entries to reference renamed definitions file.
src/Cli/Microsoft.DotNet.Cli.Utils/Polyfills.csNormalize preprocessor check from NET472 to NETFRAMEWORK.
src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csprojReplace $(ResolverTargetFramework) with $(SdkTargetFramework).
Directory.Build.propsRemove ToolsetTargetFramework / ResolverTargetFramework alias properties.

Comment threadsrc/Layout/redist/targets/Crossgen.targets
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@marcpopMSFT

Copy link
Copy Markdown
Member

@tmat did you still want this? if so, approve and I'll merge.

@marcpopMSFT

Copy link
Copy Markdown
Member

I scanned and the changes look right and look like what is in main (modulo a few files that are only in main).

@tmat

tmat commented Mar 17, 2026

Copy link
Copy Markdown
Member

Yes, please!

@marcpopMSFT
marcpopMSFT merged commit 0f974e4 into release/10.0.3xxMar 25, 2026
28 checks passed
@marcpopMSFT
marcpopMSFT deleted the copilot/port-pull52743-to-release-10-0-3xx branch March 25, 2026 20:01
Sign up for freeto 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

@marcpopMSFT@tmat