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

Add MAUI example app to csharp samples #4078

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

weslleymurdock
Copy link

This covers #4077
I've created the sample application for both iOS & Android platforms, and some modifications on makefile to generate c# PINVOKE classes to the right project as well

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2024

CLA assistant check
All committers have signed the CLA.

@trengginas
Copy link
Member

I am stuck with these error when trying to build the app:

/usr/local/share/dotnet/sdk/8.0.403/Microsoft.Common.CurrentVersion.targets(2303,5): error MSB4803: The task "ResolveNativeReference" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details. [/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/pjsua2maui.csproj::TargetFramework=net8.0-android]
/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/Platforms/iOS/CallPageHandler.cs(4,40): error CS0234: The type or namespace name 'Compatibility' does not exist in the namespace 'Microsoft.Maui.Controls.Handlers' (are you missing an assembly reference?) [/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/pjsua2maui.csproj::TargetFramework=net8.0-ios]
/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/Platforms/iOS/AppDelegate.cs(6,28): error CS0246: The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) [/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/pjsua2maui.csproj::TargetFramework=net8.0-ios]
/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/Platforms/iOS/CallPageHandler.cs(16,33): error CS0246: The type or namespace name 'VisualElementRenderer<>' could not be found (are you missing a using directive or an assembly reference?) [/pjsip/test/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui/pjsua2maui.csproj::TargetFramework=net8.0-ios]

@weslleymurdock
Copy link
Author

Hello
Which version of dotnet you`re using
Please post the dotnet setup details

@weslleymurdock
Copy link
Author

Hi again
I'll try to create a global.json to configure the .ned sdk version as the same i've used

@weslleymurdock
Copy link
Author

Hello @trengginas I've reproduced this when i'm used the global on a mac. And i've done the android sample on windows, which uses the ResolveNativeReference MSBuild Task for resolve the android libs. Try use windows while i'm working on a new android sample

@trengginas
Copy link
Member

I'm using a Mac since it's not possible to build the iOS sample app on Windows.

@weslleymurdock
Copy link
Author

To "build on windows" you can use the ssh connection of visual studio to debug and run the iOS app on emulator inside Windows Environment.
But if is not possible use a windows pc, try to build one target only (e.g Android only or iOS only).

@sauwming
Copy link
Member

I also tried this on Mac and encountered the same problem as Riza.

I downloaded the latest VS Code and followed the instruction here:
https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-9.0&tabs=visual-studio-code

Would you be able to make this work on Mac? Also, please provide us step by step detail (sorry, we are not familiar at all with MAUI project), something similar to #3584.

@weslleymurdock
Copy link
Author

@sauwming, for sure, i'll work on that today

@sauwming
Copy link
Member

Thanks, it would be better if the sample apps can work on real devices, instead of simulators. If I tried following Readme.md, I would encounter the following error:
building for iOS Simulator, but linking in object file built for iOS

@weslleymurdock
Copy link
Author

The steps for real devices are similar, but I'll improve the readme this week

@weslleymurdock
Copy link
Author

@sauwming I figure it out. The project has a conditional compilation in order to split platforme codes and resources
And the inclusion of arm64 library is included in x86_64, causing the bad linking
I'll updathe the pr with a including conditional check on arm64 lib

@weslleymurdock weslleymurdock marked this pull request as draft December 4, 2024 04:10
@weslleymurdock
Copy link
Author

Hi fowks
Im working on desktop maui samples, so i maked this as draft
It works on windows, but it still need the native platform controls implementation for video win

@sauwming
Copy link
Member

sauwming commented Dec 4, 2024

I still haven't managed to make it work on a real device.

On iOS, it will fail due to an extra opening parenthesis here:
<ItemGroup Condition="(($(RuntimeIdentifier.StartsWith('iossimulator-arm64')))">

But even after I fixed it, it still failed with "undefined references" errors.

@weslleymurdock
Copy link
Author

that's is wird... the arch on condition is for simulators running on M1/M2 macs
the undefined references is about linking
could you please post me a build with diag in order to see whats going on with linking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants