.NET 7.0.100 `dotnet test` cannot parse MSBuild switches from .rsp or command line if .NET CLI language is not `en`
See original GitHub issueDescription
dotnet test
command cannot parse parameters from provided .rsp file if .NET CLI language is de
or ru
but works fine with en
on .NET SDK 7.0.100. It leads to an error Unrecognized command or argument ...
This bug is not reproducible on the .NET SDK 6.0.402.
To Reproduce
- Create any test project in my case it’s xUnit project targeting
net7.0.
(please, check test project detail below) - Create any 1.rsp file with at least one switch, for example
-p:abc=123
- Set environment variable
DOTNET_CLI_UI_LANGUAGE
to valuede
(German). In PowerShell
PS > $env:DOTNET_CLI_UI_LANGUAGE = 'de'
- Running the following command
PS > dotnet test .\xUnit.Tests.csproj `@1.rsp
gives
Befehl oder Argument "-p:abc=123" nicht erkannt
Description:
.NET-Testtreiber
Usage:
dotnet test [<PROJECT | SOLUTION>] [options] [[--] <additional arguments>...]]
Arguments:
<PROJECT | SOLUTION> Das Projekt oder die Projektmappendatei, die verwendet werden soll. Wenn keine Datei angegeben ist,
durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei.
Options:
...
Befehl oder Argument "-p:abc=123" nicht erkannt
relates to Unrecognized command or argument "-p:abc=123"
in English.
- Set environment variable
DOTNET_CLI_UI_LANGUAGE
to valueen
(English):
PS > $env:DOTNET_CLI_UI_LANGUAGE = 'en'
- Running the following command
PS > dotnet test .\xUnit.Tests.csproj `@1.rsp
gives
Determining projects to restore...
Restored C:\Users\Maxim.Chechulnikov\sources\small-amount-of-dotnet-tests\mixed\xUnit.Tests\xUnit.Tests.csproj (in 274 ms).
xUnit.Tests -> C:\Users\Maxim.Chechulnikov\sources\small-amount-of-dotnet-tests\mixed\xUnit.Tests\bin\Debug\net7.0\xUnit.Tests.dl
l
Test run for C:\Users\Maxim.Chechulnikov\sources\small-amount-of-dotnet-tests\mixed\xUnit.Tests\bin\Debug\net7.0\xUnit.Tests.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: 100, Skipped: 0, Total: 100, Duration: 13 ms - xUnit.Tests.dll (net7.0)
An example of simplest test project
xUnit.Tests.csproj content
Content<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
UnitTests0.cs content
Contentnamespace xUnit.Tests;
public class UnitTest0
{
[Fact]
public void Test0()
{
Assert.True(true);
}
... // I have 100 same tests
}
Usings.cs content
Contentglobal using Xunit;
1.rsp content
Content-p:abc=123
Further technical details
`dotnet --info` output:
``` .NET SDK: Version: 7.0.100 Commit: e12b7af219Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.100\
Host: Version: 7.0.0 Architecture: x64 Commit: d099f075e4
.NET SDKs installed: 3.1.424 [C:\Program Files\dotnet\sdk] 6.0.401 [C:\Program Files\dotnet\sdk] 6.0.402 [C:\Program Files\dotnet\sdk] 7.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.2.22472.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
</details>
Issue Analytics
- State:
- Created 10 months ago
- Reactions:6
- Comments:9 (5 by maintainers)
Top GitHub Comments
We confirm that this is the same issue as #29543 and that it will be fixed by #29559
I’m going to close as duplicate of https://github.com/dotnet/sdk/issues/29543