Skip to content

dotnet test does no longer accept a project path after updating to NET 7.0.101 #29543

@campersau

Description

@campersau

Describe the bug

After updating NET 7.0.100 to NET 7.0.101 dotnet test does no longer accept a project path as an argument.

To Reproduce

Sample test project:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
    <PackageReference Include="xunit" Version="2.4.2" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>
using Xunit;

namespace ClassLibrary1
{
    public class Class1
    {
        [Fact]
        public void Test()
        {

        }
    }
}

With NET 7.0.101 this does not work

C:\>dotnet --version
7.0.101
C:\>dotnet test C:\Users\Administrator\Desktop\ClassLibrary1.csproj
Befehl oder Argument "C:\Users\Administrator\Desktop\ClassLibrary1.csproj" nicht erkannt

With NET 7.0.100 this worked

C:\>dotnet --version
7.0.100
C:\>dotnet test C:\Users\Administrator\Desktop\ClassLibrary1.csproj
  Determining projects to restore...
  All projects are up-to-date for restore.
  ClassLibrary1 -> C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll
Test run for C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: < 1 ms - ClassLibrary1.dll (net7.0)

This also affects the built in dotnet command in Azure Dev Ops.
image

Workarounds

  • Set the environment variable DOTNET_CLI_UI_LANGUAGE=en-US.

  • Running donet test directly in the project directory does work:

C:\Users\Administrator\Desktop>dotnet test
  Wiederherzustellende Projekte werden ermittelt...
  Alle Projekte sind für die Wiederherstellung auf dem neuesten Stand.
  ClassLibrary1 -> C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll
Testlauf für "C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll" (.NETCoreApp,Version=v7.0)
Microsoft (R) Testausführungs-Befehlszeilentool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Die Testausführung wird gestartet, bitte warten...
Insgesamt 1 Testdateien stimmten mit dem angegebenen Muster überein.

Bestanden!   : Fehler:     0, erfolgreich:     1, übersprungen:     0, gesamt:     1, Dauer: < 1 ms - ClassLibrary1.dll (net7.0)
  • Running donet test referencing a DLL or exe does work:
C:\Users\Administrator\Desktop>dotnet test C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll
  Wiederherzustellende Projekte werden ermittelt...
  Alle Projekte sind für die Wiederherstellung auf dem neuesten Stand.
  ClassLibrary1 -> C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll
Testlauf für "C:\Users\Administrator\Desktop\bin\Debug\net7.0\ClassLibrary1.dll" (.NETCoreApp,Version=v7.0)
Microsoft (R) Testausführungs-Befehlszeilentool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Die Testausführung wird gestartet, bitte warten...
Insgesamt 1 Testdateien stimmten mit dem angegebenen Muster überein.

Bestanden!   : Fehler:     0, erfolgreich:     1, übersprungen:     0, gesamt:     1, Dauer: < 1 ms - ClassLibrary1.dll (net7.0)

Further technical details

C:\>dotnet --info
.NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.20348
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.101\

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  7.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions