I'm trying to run dotnet test on a solution and unable to.
pipeline:
image: mcr.microsoft.com/dotnet/sdk:6.0pipelines: default: - step: name: Build caches: - dotnetcore script: - dotnet restore - dotnet build --no-restore --configuration Release - dotnet test --no-build --no-restore -v d
<span>Microsoft (R) Test Execution Command Line Tool Version 17.3.0 (x64)</span><span>Copyright (c) Microsoft Corporation. All rights reserved.</span><span>The argument /opt/atlassian/pipelines/agent/build/thresholds-module.tests/bin/Debug/net6.0/thresholds-module.tests.dll is invalid. Please use the /help option to check the list of valid arguments.</span><span>Test run for /opt/atlassian/pipelines/agent/build/thresholds-module.tests/bin/Debug/net6.0/thresholds-module.tests.dll (.NETCoreApp,Version=v6.0)</span>
<span>Microsoft (R) Test Execution Command Line Tool Version 17.3.0 (x64)</span>
<span>Copyright (c) Microsoft Corporation. All rights reserved.</span>
<span>The argument /opt/atlassian/pipelines/agent/build/thresholds-module.tests/bin/Debug/net6.0/thresholds-module.tests.dll is invalid. Please use the /help option to check the list of valid arguments.</span>
I found this answer on my search for the same error, so I'll answer it for the next ones coming here.
Look at the last 2 commands in your script:
- dotnet build --no-restore --configuration Release- dotnet test --no-build --no-restore -v d
You are building in Release configuration but are testing in Debug configuration.
So the dotnet test command doesn't find any assemblies for running tests due to the --no-build switch.
In this case I think it would have been much more helpful for you (and me) if the error message had been a "file not found" instead of the less specific "argument is invalid".
It looks like you're new here. Sign in or register to get started.