Skip to content

Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting#13189

Merged
YuliiaKovalova merged 3 commits intomainfrom
copilot/sub-pr-13175
Feb 3, 2026
Merged

Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting#13189
YuliiaKovalova merged 3 commits intomainfrom
copilot/sub-pr-13175

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Context

This PR adds the $(LatestDotNetCoreForMSBuild) infrastructure that centralizes the target framework version across test infrastructure. This infrastructure provides a single source of truth for the latest .NET Core target framework, making it easier to update framework versions across all test projects and test code.

Changes Made

Build infrastructure:

  • Added latestDotNetCoreForMSBuild parameter to BootstrapLocationAttribute
  • Added _Parameter4 to Microsoft.Build.UnitTests.Shared.csproj to pass the latest .NET Core TFM
  • Added LatestDotNetCoreForMSBuild property to RunnerUtilities for test access

Test code:

  • Added -p:LatestDotNetCoreForMSBuild={RunnerUtilities.LatestDotNetCoreForMSBuild} to MSBuild command invocations in BuildCheck.UnitTests/EndToEndTests.cs (2 locations)
  • Changed framework references to use RunnerUtilities.LatestDotNetCoreForMSBuild instead of hardcoded "net10.0" in:
    • Copy_Tests.cs (2 locations for path construction)
    • TerminalLogger_Tests.cs (1 test property)
  • Added using Microsoft.Build.UnitTests.Shared; to Copy_Tests.cs for access to RunnerUtilities

Test assets:

  • Changed <TargetFramework>net10.0</TargetFramework> to <TargetFramework>$(LatestDotNetCoreForMSBuild)</TargetFramework> in 8 test project files:
    • ExampleTask.csproj
    • TestNetTask.csproj
    • TestMSBuildTaskInNet.csproj
    • TestNetTaskWithImplicitParams.csproj
    • TaskHostLifecycleTestApp.csproj
    • CopyAlwaysTest/EntryProject.csproj
    • CopyAlwaysTest/ReferencedProject.csproj
    • EmbeddedResourceTest/EntryProject.csproj

Testing

Build succeeds. The infrastructure changes are tested through existing test suites that use the updated test assets.

Notes

The $(LatestDotNetCoreForMSBuild) infrastructure provides flexibility for future .NET version updates by centralizing the target framework definition. This avoids hardcoding "net10.0" throughout the test codebase and makes it easier to update to newer framework versions by changing the value in a single location (Directory.Build.props).


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

@dotnet-policy-service
Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI changed the title [WIP] Add App Host support for MSBuild Remove $(LatestDotNetCoreForMSBuild) infrastructure for separate PR Feb 3, 2026
@YuliiaKovalova
Copy link
Member

@copilot please use $(LatestDotNetCoreForMSBuild) I need this change and make main a target branch

@YuliiaKovalova YuliiaKovalova changed the title Remove $(LatestDotNetCoreForMSBuild) infrastructure for separate PR Use $(LatestDotNetCoreForMSBuild) to avoid hardcoding net target framework Feb 3, 2026
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot please use $(LatestDotNetCoreForMSBuild) I need this change and make main a target branch

I've restored the $(LatestDotNetCoreForMSBuild) infrastructure in commit fb9e1d8. The build succeeds with these changes.

Note: Changing the target branch from dev/ykovalova/app_host_support to main requires manual GitHub operation - I don't have the ability to change PR target branches programmatically. You'll need to update the target branch through the GitHub UI.

Copilot AI changed the title Use $(LatestDotNetCoreForMSBuild) to avoid hardcoding net target framework Include $(LatestDotNetCoreForMSBuild) infrastructure with app host support Feb 3, 2026
@YuliiaKovalova YuliiaKovalova changed the base branch from dev/ykovalova/app_host_support to main February 3, 2026 15:58
@YuliiaKovalova
Copy link
Member

@copilot i updated target branch
please remove extra changes, only $(LatestDotNetCoreForMSBuild) should stay here

Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot i updated target branch
please remove extra changes, only $(LatestDotNetCoreForMSBuild) should stay here

I've removed all the app host support changes and kept only the $(LatestDotNetCoreForMSBuild) infrastructure in commit 623bc22.

However, I cannot push this cleaned version because the remote branch still contains all the old commits from dev/ykovalova/app_host_support. The branch needs to be force-pushed to replace the history. Since I don't have force-push permissions, could you either:

  1. Force push my local branch, or
  2. Delete the remote branch so I can push a clean version

The current local branch (copilot/sub-pr-13175) has exactly what you requested - only the $(LatestDotNetCoreForMSBuild) infrastructure with no app host support code.

Copilot AI changed the title Include $(LatestDotNetCoreForMSBuild) infrastructure with app host support Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting Feb 3, 2026
@YuliiaKovalova YuliiaKovalova marked this pull request as ready for review February 3, 2026 16:51
@YuliiaKovalova YuliiaKovalova enabled auto-merge (squash) February 3, 2026 17:38
@YuliiaKovalova YuliiaKovalova merged commit 9324107 into main Feb 3, 2026
9 checks passed
@YuliiaKovalova YuliiaKovalova deleted the copilot/sub-pr-13175 branch February 3, 2026 20:19
JanProvaznik pushed a commit to JanProvaznik/msbuild that referenced this pull request Feb 25, 2026
…ework targeting (dotnet#13189)

### Context

This PR adds the `$(LatestDotNetCoreForMSBuild)` infrastructure that
centralizes the target framework version across test infrastructure.
This infrastructure provides a single source of truth for the latest
.NET Core target framework, making it easier to update framework
versions across all test projects and test code.

### Changes Made

**Build infrastructure:**
- Added `latestDotNetCoreForMSBuild` parameter to
`BootstrapLocationAttribute`
- Added `_Parameter4` to `Microsoft.Build.UnitTests.Shared.csproj` to
pass the latest .NET Core TFM
- Added `LatestDotNetCoreForMSBuild` property to `RunnerUtilities` for
test access

**Test code:**
- Added
`-p:LatestDotNetCoreForMSBuild={RunnerUtilities.LatestDotNetCoreForMSBuild}`
to MSBuild command invocations in
`BuildCheck.UnitTests/EndToEndTests.cs` (2 locations)
- Changed framework references to use
`RunnerUtilities.LatestDotNetCoreForMSBuild` instead of hardcoded
`"net10.0"` in:
  - `Copy_Tests.cs` (2 locations for path construction)
  - `TerminalLogger_Tests.cs` (1 test property)
- Added `using Microsoft.Build.UnitTests.Shared;` to `Copy_Tests.cs` for
access to `RunnerUtilities`

**Test assets:**
- Changed `<TargetFramework>net10.0</TargetFramework>` to
`<TargetFramework>$(LatestDotNetCoreForMSBuild)</TargetFramework>` in 8
test project files:
  - `ExampleTask.csproj`
  - `TestNetTask.csproj`
  - `TestMSBuildTaskInNet.csproj`
  - `TestNetTaskWithImplicitParams.csproj`
  - `TaskHostLifecycleTestApp.csproj`
  - `CopyAlwaysTest/EntryProject.csproj`
  - `CopyAlwaysTest/ReferencedProject.csproj`
  - `EmbeddedResourceTest/EntryProject.csproj`

### Testing

Build succeeds. The infrastructure changes are tested through existing
test suites that use the updated test assets.

### Notes

The $(LatestDotNetCoreForMSBuild) infrastructure provides flexibility
for future .NET version updates by centralizing the target framework
definition. This avoids hardcoding "net10.0" throughout the test
codebase and makes it easier to update to newer framework versions by
changing the value in a single location (`Directory.Build.props`).

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 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](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: YuliiaKovalova <ykovalova@microsoft.com>
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.

3 participants