I have a solution that contains a bunch of projects, including a MAUI project. I want to run dotnet test
, and only run platform agnostic tests (i.e. net8.0
frameworks). I do that with the following command:
dotnet test MySolution.sln --framework=net8.0
I still get errors however, because it still tries to build the MAUI project for android:
Error: /usr/share/dotnet/sdk/8.0.303/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android [/home/runner/work/trunk/trunk/MyFms.CarSharing/MyFms.CarSharing.App/MyFms.CarSharing.App.csproj::TargetFramework=net8.0-android]
I’m assuming that this is because the MAUI project does not have a net8.0
target?
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
What would be the proper way for me to run dotnet test
against this solution, without it trying to build the MAUI project?