Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting#13189
Add $(LatestDotNetCoreForMSBuild) infrastructure for centralized framework targeting#13189YuliiaKovalova merged 3 commits intomainfrom
Conversation
|
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 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 |
|
@copilot i updated target branch |
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:
The current local branch (copilot/sub-pr-13175) has exactly what you requested - only the $(LatestDotNetCoreForMSBuild) infrastructure with no app host support code. |
…rate PR" This reverts commit 1915bee.
4e6e503 to
31a2104
Compare
…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>
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:
latestDotNetCoreForMSBuildparameter toBootstrapLocationAttribute_Parameter4toMicrosoft.Build.UnitTests.Shared.csprojto pass the latest .NET Core TFMLatestDotNetCoreForMSBuildproperty toRunnerUtilitiesfor test accessTest code:
-p:LatestDotNetCoreForMSBuild={RunnerUtilities.LatestDotNetCoreForMSBuild}to MSBuild command invocations inBuildCheck.UnitTests/EndToEndTests.cs(2 locations)RunnerUtilities.LatestDotNetCoreForMSBuildinstead of hardcoded"net10.0"in:Copy_Tests.cs(2 locations for path construction)TerminalLogger_Tests.cs(1 test property)using Microsoft.Build.UnitTests.Shared;toCopy_Tests.csfor access toRunnerUtilitiesTest assets:
<TargetFramework>net10.0</TargetFramework>to<TargetFramework>$(LatestDotNetCoreForMSBuild)</TargetFramework>in 8 test project files:ExampleTask.csprojTestNetTask.csprojTestMSBuildTaskInNet.csprojTestNetTaskWithImplicitParams.csprojTaskHostLifecycleTestApp.csprojCopyAlwaysTest/EntryProject.csprojCopyAlwaysTest/ReferencedProject.csprojEmbeddedResourceTest/EntryProject.csprojTesting
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.