Skip to content

Add test for dotnet test with UseAppHost=false in MTP #50109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 7, 2025

This PR adds a test case to verify that Microsoft Testing Platform (MTP) projects work correctly when UseAppHost=false is configured.

Background

When UseAppHost=false, .NET projects don't generate an executable host and instead rely on dotnet exec mydll.dll for execution. This scenario needed test coverage to ensure MTP projects function properly in this configuration.

Changes

  • Added test case RunMTPProjectWithUseAppHostFalse_ShouldWork that verifies MTP projects execute successfully with UseAppHost=false
  • Created test asset TestProjectMTPWithUseAppHostFalse combining MTP configuration with UseAppHost=false
  • Added dotnet.config file specifying Microsoft.Testing.Platform usage
  • Made package references conditional to avoid network dependencies during testing

The test ensures that the basic functionality of running MTP projects with UseAppHost=false works as expected, providing confidence that this configuration is properly supported.

Fixes #49718.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] dotnet test for MTP: Add test for UseAppHost=false and support this case Add architecture validation for dotnet test with UseAppHost=false in MTP Aug 7, 2025
@Copilot Copilot AI requested a review from Youssef1313 August 7, 2025 10:35
Copilot finished work on behalf of Youssef1313 August 7, 2025 10:35
Copy link
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please create dotnet.config in test/TestAssets/TestProjects/TestProjectMTPWithUseAppHostFalse` specifying Microsoft.Testing.Platform.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please revert the changes in TestApplication.cs

The GenerateProgramFile property is already set to false for all test projects
in Directory.Build.props, making it redundant in individual test project files.

Co-authored-by: Youssef1313 <[email protected]>
Copilot finished work on behalf of Youssef1313 August 9, 2025 03:28
@Copilot Copilot AI requested a review from Youssef1313 August 9, 2025 03:28
…onfig, revert TestApplication.cs, update test to use dedicated test asset

Co-authored-by: Youssef1313 <[email protected]>
Copy link
Contributor Author

Copilot AI commented Aug 9, 2025

@copilot Please create dotnet.config in test/TestAssets/TestProjects/TestProjectMTPWithUseAppHostFalse` specifying Microsoft.Testing.Platform.

Created dotnet.config in test/TestAssets/TestProjects/TestProjectMTPWithUseAppHostFalse specifying Microsoft.Testing.Platform. Added in commit 628f1b7.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 5rqvsblobprodcus385.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/sdk/sdk/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:false /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=true /home/REDACTED/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.25377.103/tools/Build.proj /bl:&#34;/home/REDACTED/work/sdk/sdk/artifacts/log/Release/Build.binlog&#34; /p:Configuration=Release /p:RepoRoot=/home/REDACTED/work/sdk/sdk/ /p:Restore=true /p:Build=true /p:DotNetBuild=false /p:DotNetBuildSourceOnly=false /p:DotNetBuildFromVMR=false /p:Rebuild=false /p:Test=false /p:Pack=false /p:IntegrationTest=false /p:PerformanceTest=false /p:Sign=false /p:Publish=false /p:RestoreStaticGraphEnableBinaryLogger=true /p:SkipUsingCrossgen=true /p:SkipBuildingInstallers=true -logger:/home/REDACTED/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.25377.103/tools/net/Microsoft.DotNet.ArcadeLogging.dll (dns block)
  • pe4vsblobprodcus351.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/sdk/sdk/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:false /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=true /home/REDACTED/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.25377.103/tools/Build.proj /bl:&#34;/home/REDACTED/work/sdk/sdk/artifacts/log/Release/Build.binlog&#34; /p:Configuration=Release /p:RepoRoot=/home/REDACTED/work/sdk/sdk/ /p:Restore=true /p:Build=true /p:DotNetBuild=false /p:DotNetBuildSourceOnly=false /p:DotNetBuildFromVMR=false /p:Rebuild=false /p:Test=false /p:Pack=false /p:IntegrationTest=false /p:PerformanceTest=false /p:Sign=false /p:Publish=false /p:RestoreStaticGraphEnableBinaryLogger=true /p:SkipUsingCrossgen=true /p:SkipBuildingInstallers=true -logger:/home/REDACTED/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.25377.103/tools/net/Microsoft.DotNet.ArcadeLogging.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of Youssef1313 August 9, 2025 03:43
…houldWork, and make it a positive test

Co-authored-by: Youssef1313 <[email protected]>
@Copilot Copilot AI changed the title Add architecture validation for dotnet test with UseAppHost=false in MTP Add test for dotnet test with UseAppHost=false in MTP Aug 9, 2025
@Copilot Copilot AI requested a review from Youssef1313 August 9, 2025 04:39
Copilot finished work on behalf of Youssef1313 August 9, 2025 04:39
@Youssef1313 Youssef1313 marked this pull request as ready for review August 9, 2025 06:54
@Copilot Copilot AI review requested due to automatic review settings August 9, 2025 06:54
@Youssef1313 Youssef1313 enabled auto-merge (squash) August 9, 2025 06:54
Copy link
Contributor

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

This PR adds test coverage to verify that Microsoft Testing Platform (MTP) projects work correctly when UseAppHost=false is configured. This ensures that MTP projects can run using dotnet exec mydll.dll instead of generating an executable host.

  • Added a new test case RunMTPProjectWithUseAppHostFalse_ShouldWork to verify MTP functionality with UseAppHost=false
  • Created a test asset project with minimal MTP configuration and UseAppHost=false setting
  • Implemented conditional package references to avoid network dependencies during testing

Reviewed Changes

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

File Description
GivenDotnetTestBuildsAndRunsTests.cs Added test method to verify MTP projects work with UseAppHost=false
dotnet.config Configuration file enabling Microsoft Testing Platform for the test asset
TestProjectMTPWithUseAppHostFalse.csproj Project file with UseAppHost=false and conditional MTP package reference
Program.cs Minimal MTP test implementation with dummy test adapter

auto-merge was automatically disabled August 9, 2025 07:05

Head branch was pushed to by a user without write access

@Copilot Copilot AI requested a review from Youssef1313 August 9, 2025 07:06
Copilot finished work on behalf of Youssef1313 August 9, 2025 07:06
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.

dotnet test for MTP: Add test for UseAppHost=false and support this case
2 participants