Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing the Microsoft.NET.Test.Sdk NuGet package did NOT fix this issue for dotnet test commands. They are still failing in build environments. #39814

Closed
nohwnd opened this issue Mar 27, 2024 · 4 comments
Labels
Area-DotNet Test untriaged Request triage from a team member

Comments

@nohwnd
Copy link
Member

nohwnd commented Mar 27, 2024

Referencing the Microsoft.NET.Test.Sdk NuGet package did NOT fix this issue for dotnet test commands. They are still failing in build environments.

Still experiencing the issue on .NET 8.0.203 when referencing the following packages in test projects:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*-*" />
<PackageReference Include="Microsoft.TestPlatform" Version="17.*-*" />

Originally posted by @robertmclaws in #38473 (comment)

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Mar 27, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@nohwnd
Copy link
Member Author

nohwnd commented Mar 27, 2024

Do you have a simple repro of the problem please? Are you referencing the full Microsoft.TestPlatform package because you need to find the runner afterwards? How exactly are you running your tests? Is it via dotnet test of through vstest.console.exe from the referenced Microsoft.TestPlatform package?

@robertmclaws
Copy link

Here's a repro branch and build where the error happens:
https://github.com/simple-odata-client/Simple.OData.Client/actions/runs/8462294502/job/23183433497?pr=929#step:6:31

Of note, the project Simple.OData.Tests.Shared.NorthwindService is NOT a unit test project. However, the only way to make this issue go away is to add those two test packages to this non-test project, as I did here: https://github.com/simple-odata-client/Simple.OData.Client/actions/runs/8447531397/job/23138040282.

Then the build will execute properly.

The codebase in question uses Directory.Build.props to pull the two packages above into the other test projects.

Lemme know if you have any questions. Thanks!

@nohwnd
Copy link
Member Author

nohwnd commented Mar 28, 2024

Your directory build props mark the project as IsTestProject which is used by the VSTest build target to either run or skip tests. This is normally used to suppress running test projects when they have all the dependencies (like Microsoft.NET.Test.SDK) but don't hold any tests. You are facing the problem from the other side.

@nohwnd nohwnd closed this as completed Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DotNet Test untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants