I have a single-project MAUI app targeting ‘pure’ .net, .net-android and .net-ios. Furthermore, I have a Unit-test project, that targets ‘pure’ .net. The only reason for targeting .net in the single-project MAUI app, is to be able to run the unit tests against the project. The unit-test project is testing ViewModels and Services only, no UI.
Until now, all the 3. party nugets I have used, are targeting all three platforms
- .net
- .net-android
- .net-ios
and therefore I can run the .net unit tests suite in Visual Studio on my Windows PC, and in an Azure Pipeline.
Now the problem is, that a new nuget that I need, do not target .net, only .net-android and .net-ios. The Android and iOS is what I need as such for my end-users, but I do need .net in order to run the unit tests.
Back in the Xamarin.Forms days, I had a shared .net project, that android and ios just depended on. And a unit test-suite for the shared .net project (no test for the android and ios projects).
What should I do?
- Try to make the unit test run on android? Seems like that would introduce a lot of complexity to my setup. Furthermore, targeting a ‘neutral’ platform (.net) seems to be the right choice, as the unit tests are not specific to either android nor ios.
- Do scripting in my Azure Pipeline in order to remove the no-‘.net’ nugets and remove the files using these nugets etc. in the unit-test step? That would make my unable to test the remove code obviously, but the rest of the code I could still test.
Neither seems like a great option to me. What should I do?