question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running `dotnet test` on a project that uses optional workloads can't find them

See original GitHub issue

Describe the bug

Running dotnet test on a project that has an optional workload (or maybe we got a bad workload) results in an error:

Testhost process exited with error: It was not possible to find any compatible framework version 
The framework 'Microsoft.Maui.Core', version '**FromWorkload**' (x64) was not found. 

If I set an explicit version, the error is the same - just with **FromWorkload** replaced with <version>.

I get the same error in Visual Studio when running tests in the Test Explorer.

To Reproduce

The repo: https://github.com/mattleibow/OptionalWorkloadsTests The run: https://github.com/mattleibow/OptionalWorkloadsTests/runs/3828827544

Exceptions (if any)

Test run for D:\a\OptionalWorkloadsTests\OptionalWorkloadsTests\OptionalWorkloadsTests\bin\Debug\net6.0\OptionalWorkloadsTests.dll (.NETCoreApp,Version=v6.0) 
Microsoft (R) Test Execution Command Line Tool Version 17.0.0 
Copyright (c) Microsoft Corporation. All rights reserved. 
 
Starting test execution, please wait... 
A total of 1 test files matched the specified pattern. 
Testhost process exited with error: It was not possible to find any compatible framework version 
The framework 'Microsoft.Maui.Core', version '**FromWorkload**' (x64) was not found. 
 - No frameworks were found. 
You can resolve the problem by installing the specified framework and/or SDK. 
The specified framework can be found at: 
 - aka.ms/dotnet-core-applaunch?framework=Microsoft.Maui.Core&framework_version=6.0.101-preview.9.1843&arch=x64&rid=win10-x64. Please check the diagnostic logs for more information. 
 
Test Run Aborted.

Further technical details

> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.2.21505.1
 Commit:    a151058157

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22468
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.1\

Host (useful for support):
  Version: 6.0.0-rc.2.21474.18
  Commit:  d1c6659c2d

.NET SDKs installed:
  2.1.816 [C:\Program Files\dotnet\sdk]
  3.1.411 [C:\Program Files\dotnet\sdk]
  5.0.205 [C:\Program Files\dotnet\sdk]
  5.0.302 [C:\Program Files\dotnet\sdk]
  5.0.400 [C:\Program Files\dotnet\sdk]
  6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]
  6.0.100-rc.1.21463.6 [C:\Program Files\dotnet\sdk]
  6.0.100-rc.2.21478.25 [C:\Program Files\dotnet\sdk]
  6.0.100-rc.2.21505.1 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.2.21470.37 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.2.21475.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.2.21470.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.2.21474.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.2.21470.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.2.21475.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
jonathanpepperscommented, Oct 18, 2021

Thanks, it looks like this fixes it: https://github.com/dotnet/maui/pull/3017

1reaction
drasticactionscommented, Oct 11, 2021

We’re hitting this issue trying to come up with Component tests for XAML Hot Reload for MAUI. If I try to reference specific versions of MAUI using the MauiVersion tag and run it through a test runner I get the same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >
`dotnet test` fails on a Maui project due to a dependency on ...
I want to be able to test the app without installing a Tizen dependency. Searching online, I can see some references to earlier...
Read more >
dotnet test fails when test project targets net6.0-windows10 ...
We have MAUI apllication which targets "net6.0-android/net6.0-ios" and it cannot target simply "net6.0" framework because of 3rd party nuget ...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >
Dotnet build linux. The answer you're looking for is basically
The dotnet run command provides a convenient option to run your application ... After installing it, you can use MSBuild through dotnet build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found