xUnit-cli can't find dotnet on MacOS

127 Views Asked by At

I have a Xamarin forms project that I'm running on an Intel Mac. We are using XUnit for unit testing, and I would like to be able to run the tests on the command line on my Mac. The tests run inside the IDE but I can't get them to run on the command line. I have tried many different options and nothing seems to work. The current way I'm trying to get the tests to run is by using the XUnit cli tool.

I have dotnet installed and on my path, running
dotnet --version
returns
6.0.110

I installed xunit-cli with the following command
dotnet tool install -g xunit-cli

and I've added xunit on my path, however, when I run the xunit-cli I get the following error

You must install .NET to run this application.

App: /Users/luke/.dotnet/tools/xunit
Architecture: x64
App host version: 6.0.10
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.13-x64&apphost_version=6.0.10

What part of my setup is incorrect?

1

There are 1 best solutions below

2
Cheesebaron On

Do you really need to use xunit-cli?

You can simply install the Microsoft.NET.Test.Sdk NuGet package in your test project and use dotnet test instead:

dotnet test MyProject.csproj