Question: why not add `IsTestProject` to project property when create a test project?
See original GitHub issueAs the title, why not add <IsTestProject>true</IsTestProject>
to the test project,
it seemed the ci platform like azure devops and travis will not run the test when no <IsTestProject>true</IsTestProject>
specified
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:25 (6 by maintainers)
Top Results From Across the Web
Preventing a project from being discovered as a test project
This is the error that I was running into that is fixed by adding the above ... Test discovery or execution might not...
Read more >Make dotnet test work on solution files - Martin Ullrich
The dotnet cli's test command can be run on any msbuild project or solution, yet it fails when run on non-test projects and...
Read more >dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >Test Explorer fails to execute any tests under netcore3.1 ...
Trying the same project (minus the net5.0 target) in Visual Studio 16.7.x, I can successfully execute tests for both net461 and netcoreapp3.1 with...
Read more >Moving to SDK-Style projects and package references in ...
The Math class is has only two methods, Add, and AsJson, the latter just returns a json representation of the last result of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have found the solution for this problem. This is my scenario:
~/.nuget
directoryIf I run this, it fails:
If I
dotnet restore
, then run it, it works.I with I did not have to restore again. Adding
<IsTestProject>true</IsTestProject>
works, too.Not having the package at
~\.nuget\packages\microsoft.net.test.sdk\17.2.0\build\netcoreapp2.1\
is making it not find the .targets and .props files, I guess.I ran into this problem when building the project as root and trying to run the tests as a non-root user.
I believe the problem comes down to
Microsoft.NET.Test.Sdk.props
being unreadable by the user trying to run the tests, as it’s under/root
.A workaround is setting
NUGET_PACKAGES
to/tmp/.nuget/packages
.To see the issue:
Running the tests as root works:
Running the tests as a non-root user gives no output:
But if you set
NUGET_PACKAGES=/tmp/.nuget/packages
, you get this: