-
Notifications
You must be signed in to change notification settings - Fork 291
Description
Describe the bug
When a MTP test project in .NET 10.0.100 (using either Microsoft.NET.Sdk or MSTest.Sdk) uses a file Directory.Build.props that changes the MSBuild property OutputPath to a value that uses the MSBuild property Configuration, dotnet test fails (although with different errors depending on the project sdk):
File Directory.Build.props:
<Project>
<PropertyGroup>
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(Configuration)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<OutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
</Project>
(Notice the use of the property $(Configuration))
Steps To Reproduce
Repos:
-
Case 1 (Microsoft.NET.Sdk): https://github.com/carl-quintero/Sample-Microsoft.NET.Sdk
-
Case 2 (MSTest.SDK): https://github.com/carl-quintero/Sample-MSTest.SDK
Steps:
-
Clone the repo(s)
-
Open a CMD terminal
-
Change the directory to the directory of the cloned repo
-
Run:
dotnet test
Expected behavior
Tests should be found and executed
Actual behavior
-
Case 1 (Microsoft.NET.Sdk):
You get error:
Get projects properties with MSBuild didn't execute properly with exit code: 1.(In this case at the very least it should be desirable a more helpful error message)
-
Case 2 (MSTest.SDK):
You get error:
System.ComponentModel.Win32Exception (2): An error occurred trying to start process '<folder_redacted>\Sample-MSTest.SDK\bin\Test\net10.0\Test.exe' with working directory '<folder_redacted>\Sample-MSTest.SDK'. The system cannot find the file specified.Notice that the problem is that the output folder
bin\Test\net10.0is used instead of the correct one with theConfiguration:bin\Debug\Test\net10.0
Additional context
dotnet test works fine if you delete (or rename) the file Directory.Build.props.
I am aware that I could use dotnet test --test-modules with the compiled binaries (which is what I use in CI/CD pipelines), but for development in the command-line I would like to keep using the dotnet test experience.