maui
maui copied to clipboard
Cannot reference MAUI-Blazor project from another MAUI-Blazor project on iOS
Description
I'd like to use shared library with MAUI-Blazor project. Unfortunately, currently it fails with the following error:
error NETSDK1005: Assets file '...\obj\project.assets.json' doesn't have a target for 'net6.0-ios'.
Note that it works perfectly fine with Android or Windows targets.
Repro: https://github.com/Dreamescaper/maui-3536-repro
Steps to Reproduce
- Open attached project.
- Try to build / run MauiApp1 on Remote Simulator.
Version with bug
Preview 10 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 15
Did you find any workaround?
No.
Relevant log output
2>C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file 'C:\Users\master\source\repos\MauiAppLib\Lib\obj\project.assets.json' doesn't have a target for 'net6.0-ios'. Ensure that restore has run and that you have included 'net6.0-ios' in the TargetFrameworks for your project.
2>Done building project "Lib.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Hi @Dreamescaper , when you say shared lib, do you mean actual shared source (unlikely?), or do you mean this:
- Class lib that has Razor + MAUI stuff in it (SDK = Razor, UseMaui=true)
- MAUI app project that references that class lib
If so, we're tracking that in https://github.com/dotnet/maui/issues/3288.
Does it seem the same, or does this seem different?
The description of the item seems to be correct, but actual results are different.
-
That bug mentions that component does not display anymore. In my case I cannot even build it, it fails.
-
It reproduces only on iOS.
OK thanks let's keep this open.
BTW can you upload the repro project as a GitHub repo instead of a ZIP? We're not allowed to open ZIP attachments unfortunately.
Actually, in my case (MobileBlazorBindings project) I don't even care about .razor files, there are none. But I need to get access to BlazorWebView type, therefore I need to set SDK to Razor to get it.
Anyway, if that's the same issue - feel free to close it.
Well, we'll try to fix one and we'll see if it fixes the other π
BTW can you upload the repro project as a GitHub repo instead of a ZIP? We're not allowed to open ZIP attachments unfortunately.
https://github.com/Dreamescaper/maui-3536-repro
I don't think this is a scenario we plan to support.
Blazor wise, only RCLs are the way to share components and static web assets. If you have a Maui app we don't expect the content to be referenceable from another project in the same way that we don't support scenarios where a web project references another web project.
Only web/maui/wasm references to RCLs are expected to work.
@Eilon feel free to close this issue at your discretion.
In my particular case I only need to access BlazorWebView type in my lib. If there's any way to get it without setting the SDK to Razor, that would solve my issue. ( Currently it fails due to missing targets if I attempt to add Microsoft.AspNetCore.Components.WebView.Maui package manually to non-Razor project)
@javiercn I think this is a scenario we must support, but it might not be clear to everyone what it is.
Imagine a MAUI class lib with some MAUI control that internally uses a BlazorWebView and thus needs some Razor files and static assets. It would use the Razor SDK, plus have UseMaui=true.
This scenario is not about referencing a MAUI app as if it is a "regular" class lib.
Verified repro with iPhone 13 pro max IOS 15.2 Simulator and the above project.
We've moved this issue to the Future milestone. This means that it is not going to be worked on for the coming release. We will reassess the issue following the current release and consider this item at that time.
Verified this issue with Visual Studio Enterprise 17.6.0 Preview 2.0. Repro on iOS simulator(16.2) with sample project.
https://github.com/Dreamescaper/maui-3536-repro
