3

I have a dotnet core project that I have already compiled:

> dotnet build --configuration Release

If I try to run the test using the resulting dll using the /p option, it fails:

> dotnet test .\bin\Release\netcoreapp3.1\MyProject.dll /p:CollectCoverage=true
Microsoft (R) Test Execution Command Line Tool Version 16.10.0
Copyright (c) Microsoft Corporation.  All rights reserved.

The argument /p:CollectCoverage=true is invalid. Please use the /help option to check the list of valid arguments.

Does anybody know how I could pass the /p option when providing a dll?

Note that I know that I could use the --no-build option like this:

> dotnet test --configuration Release --no-build /p:CollectCoverage=true

Unfortunately, for some reasons that would be too long to explain here, I can't use that option. I really have to call dotnet test by providing a path to an already existing dll.

1 Answer 1

0

The issue arises because the /p option is a build property that is passed to the build phase of dotnet test. However, when running tests directly from a DLL (e.g., MyProject.dll), the dotnet test command skips the build phase entirely. Consequently, build properties such as /p:CollectCoverage=true are not applicable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.