question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet test -p:Platform does not appear to work anymore

See original GitHub issue

Describe the bug

On dotnet test version 17.1.1.12406, the following worked fine:

dotnet test foo.bar.tests --no-build -c Debug /property:Platform="AnyCPU"

whereas on dotnet test version 17.4.0.51802 the platform property is completely ignored. On the machine with the lower version, I have .NET 6.0 (6.0.203), whereas on the machine with the higher version I have .NET 7.0 (7.0.100).

To Reproduce

Create a C# test assembly which has a platform defined (e.g. AnyCPU), add a unit test to it, and try the above.

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version
  • Output of dotnet --info on the machine where it works:

.NET SDK (reflecting any global.json): Version: 6.0.203 Commit: a20feadf6d

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.203\

global.json file: Not found

Host: Version: 6.0.11 Architecture: x64 Commit: 943474ca16

.NET SDKs installed: 3.1.425 [C:\Program Files\dotnet\sdk] 6.0.201 [C:\Program Files\dotnet\sdk] 6.0.202 [C:\Program Files\dotnet\sdk] 6.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  • Output of dotnet --info on the machine where it does not work:

.NET SDK: Version: 7.0.100 Commit: e12b7af219

Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.100\

Host (useful for support): Version: 3.1.31 Commit: 0e404aa9b8

.NET Core SDKs installed: 3.1.425 [C:\Jenkins\core-cli-tools\sdk] 7.0.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.31 [C:\Jenkins\core-cli-tools\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.11 [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.31 [C:\Jenkins\core-cli-tools\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.11 [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.31 [C:\Jenkins\core-cli-tools\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rogerlordcommented, Nov 11, 2022

Many thanks!

1reaction
Evangelinkcommented, Nov 11, 2022

Hi @rogerlord, thanks for your feedback!

This is a dupe of https://github.com/microsoft/vstest/issues/4014. Issue is fixed and it will be available in .NET 7.0.101.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'dotnet test' doesn't discover any test
For running xUnit tests from command line, you will need the xunit.runner.console package.
Read more >
dotnet test does not detect tests using Test SDK 16.9.1 and ...
The project is created with a simple empty test, which I can see in the test explorer and execute through it. ... Downgrading...
Read more >
Test discovery for .Net Core Unit Test does not work if ...
I'm working on a multi-platform library project (net46/netstandard1.5/netstandard2.0/uap10.0) that runs fine with some tweaking.
Read more >
How To Resolve Issue Of Test Project Not Running The ...
Introduction. I was upgrading the .NET Core 3.1 project to .NET 6 and faced issues running test cases in my test projects.
Read more >
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given solution. The dotnet test command builds the solution and runs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found