You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting (#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>
Copy file name to clipboardExpand all lines: src/Build.UnitTests/TestAssets/ExampleNetTask/TestNetTaskWithImplicitParams/TestNetTaskWithImplicitParams.csproj
0 commit comments