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

Impossible to run any UnitTest on MAUI #17914

Closed
vsfeedback opened this issue Oct 9, 2023 · 3 comments
Closed

Impossible to run any UnitTest on MAUI #17914

vsfeedback opened this issue Oct 9, 2023 · 3 comments
Labels
area-testing Unit tests, device tests t/bug Something isn't working

Comments

@vsfeedback
Copy link

vsfeedback commented Oct 9, 2023

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
Hello everyone,
I didn't know true before and it solved my problem with my class library.

On my UI .csproject I defined:

<PropertyGroup>
  <UseMaui>true</UseMaui>
  <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0;net7.0-  android33.0</TargetFrameworks>
</PropertyGroup>

And on my Interface .csproject (which is a Class library), I defined:

<PropertyGroup>
  <TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

Unfortunately, now I have a problem with my MsTest UnitTest project which references my UI project!

I receive the error:

"Framework: 'Microsoft.Maui.Core', version '7.0.92' (x64). .NET location: C:\Program Files\dotnet? No frameworks were found."

Desperately, the message is incorrect and directed in the wrong direction!
Because, I installed all MAUI workloads and especially as explained above the problem comes from a configuration to be applied...
Could you please help me to find this configuration?

I thank you in advance!
Best regards

Davy


Original Comments

Feedback Bot on 10/6/2023, 06:57 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@samhouts samhouts added the t/bug Something isn't working label Oct 9, 2023
@drasticactions
Copy link
Contributor

This is the same as #17791

They are referencing a generic class project (net7.0) into the UI Project (which are all platform specific). The error is correct. If you want to test UI specific code, you would need a test runner and do it on device. If there is code beyond UI that is generic, but inside of that project, it would need to be moved out into a class library that did target net7.0 specifically.

@Eilon Eilon added the area-testing Unit tests, device tests label Oct 11, 2023
@jsiemensLatitudegeo
Copy link

I have the same problem.

@mattleibow
Copy link
Member

Duplicate of #11575

@mattleibow mattleibow marked this as a duplicate of #11575 Nov 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing Unit tests, device tests t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants