C
C#2y ago
.koujaku

❔ Abusing Maui for Cross Platform XR

Some context first: I'm working on a set of templates for my code first XR app development library, StereoKit. I've wanted for ages to have a single project that could run on Android, Windows, and Linux, and Maui seems to be set up to enable this sort of thing! I've already created a template that basically does the majority of what I want (here: https://github.com/StereoKit/StereoKit.Templates), but I've been having some trouble taking it over the finish lines with usability polish. It all works if you know to check hidden boxes, switch multiple menu items, and chant the right incantations. I suspect the big tricky element is that to get Linux support (which Maui does not do), I had to add a regular net7.0 project type to Maui's repertoire. That was a pretty scary delve into MSBuild (which starts over here: https://github.com/StereoKit/StereoKit/blob/develop/StereoKit/SKMaui.targets), but ultimately seems to work. The problems: There's unfortunately a few issues with the template when used with Visual Studio! - The Android/Windows target doesn't have the Deploy option set by default, the user has to know to hunt this option down in the Configuration Manager panel. I haven't figured out what controls this. - The net7.0-windows target is selected by default, and I'd prefer the net7.0 to be the default. Also can't figure out how this is set. - Launching net7.0-windows seems to require a launchSettings.json profile with a commandName of MsixPackage, otherwise it just silently fails. net7.0 will fail unless the profile's commandName is Project. Switching to the net7.0-windows framework seems to automatically pick the MsixPackage profile, but switching back to net7.0 does not. This behavior is... not great, and I really don't want to teach this to my users. There's likely more issues, but these are the ones on top of my mind right now. Any recommendations or insight is quite welcome!
8 Replies
.koujaku
.koujakuOP2y ago
Oh, yeah, the VS Code tag 😄 There's some issues there too, but I suppose this is mostly about VS Prime I'll also note, I'm not using any of Maui's UI capabilities, literally just the multi-platform targeting functionality!
Henkypenky
Henkypenky2y ago
if u want to use unpackaged you need to explicitly say so in .csproj add
<WindowsPackageType>None</WindowsPackageType>
<WindowsPackageType>None</WindowsPackageType>
then in launchsettings.json
{
"profiles": {
"Windows Machine": {
"commandName": "Project",
"nativeDebugging": false
}
}
}
{
"profiles": {
"Windows Machine": {
"commandName": "Project",
"nativeDebugging": false
}
}
}
why net7.0? you are targeting different sub frameworks and finally don't understand what you mean in point 1
.koujaku
.koujakuOP2y ago
Oh heck yeah, WindowsPackageType of None works great for me, thanks for that! I'm not specifically attached to net7.0, I realize there's probably a framework selector thing I could likely use? StereoKit itself is netstandard2.0, but the templates here are set up to use some of the newer language features. If you mean net7.0 specifically and not the 7 family, this is the framework I use for deploy on Linux! I also like the simplicity and build times for it, so I generally use that for most Windows development as well. Like I mentioned, I'm not attached to the WinUI features of Maui at all, just the cross-platform project tooling.
Henkypenky
Henkypenky2y ago
oh linux missed that part well glad i could help don't know about first point though (didn't understand it) and also linux never tinkered with it (in maui)
.koujaku
.koujakuOP2y ago
For the first item, it's a weird problem I haven't really seen elsewhere? It definitely doesn't happen in the default Maui templates, but I'm uncertain what causes it! Basically the "Deploy" option over here is unchecked by default for net7.0-android, which... fairly silently prevents the app from deploying 😄
.koujaku
.koujakuOP2y ago
Yeah, Maui doesn't do Linux at allll, I spent probably a month tinkering around in MSBuild trying to tie a regular net7.0 framework into Maui's build pipeline
Henkypenky
Henkypenky2y ago
maybe it has to do with the multi deployments you can make by default it comes windows stated in csproj with a condition i think
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server