Skip to content

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

Open
Copilot wants to merge 3 commits intorelease/10.0.3xxfrom
copilot/port-pull52743-to-release-10-0-3xx
Open

Port #52743 to release/10.0.3xx: Remove ResolverTargetFramework and ToolsetTargetFramework aliases#53309
Copilot wants to merge 3 commits intorelease/10.0.3xxfrom
copilot/port-pull52743-to-release-10-0-3xx

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

  • 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.

Copilot AI changed the title [WIP] Port changes from PR #52743 to release/10.0.3xx Port #52743 to release/10.0.3xx: Remove ResolverTargetFramework and ToolsetTargetFramework aliases Mar 6, 2026
@marcpopMSFT
Copy link
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)'.

Copy link
Contributor Author

Copilot AI commented Mar 6, 2026

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

Copilot AI and 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 owners March 16, 2026 22:58
Copilot AI review requested due to automatic review settings March 16, 2026 22:58
@marcpopMSFT marcpopMSFT force-pushed the copilot/port-pull52743-to-release-10-0-3xx branch from c4e7e7e to 95cd079 Compare March 16, 2026 22:58
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.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@marcpopMSFT
Copy link
Member

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

@marcpopMSFT
Copy link
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
Copy link
Member

tmat commented Mar 17, 2026

Yes, please!

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