Skip to content

Unit test projects can't reference Maui multi target projects #3552

@JohnHDev

Description

@JohnHDev

Description

With the new design for multi target projects, we need to be able to unit test ViewModels stored in Maui projects.

We could move ViewModels into pure .net 6 projects, but dependencies that are defined in other multi target projects with platform specific implementations can't be mocked regardless without also moving the interfaces for those dependencies into .net 6 projects. That largely negates the positives of multi target projects if we have to create other projects just to contain the Interface definitions and view models.

Steps to Reproduce

Create a .NET Maui solution
Create a ViewModel to the .NET Maui project.
Create a unit test project and add a reference to the .NET Maui project.

Version with bug

Preview 10 (current)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

All

Did you find any workaround?

Create another .net 6 project for view modals and interfaces that the tests and .net maui projects can reference.
That just doesn't scale well.

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

area-testingUnit tests, device testspartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withs/verifiedVerified / Reproducible Issue ready for Engineering Triaget/enhancement ☀️New feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions