question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`<MauiAsset>` is hard to use

See original GitHub issue

Description

I added a <MauiAsset Include="Resources\Assets\*"> in my project and I was unable to easily find how to retrieve it. I used Essentials’ FileSystem.OpenAppPackageFileAsync and I found that it went to different folders:

  • Windows => Assets\Resources\Assets*
  • Android => Resources\Assets*
  • iOS/MacCat => error : The name ‘Resources’ is reserved and cannot be used.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattleibowcommented, Nov 5, 2021

@Eilon I think whatever we do is going to affect Blazor. I think we need to get that #791 change in. Just looking at your issues, I see there are a few around this.

We probablu need somehting for Blazor (that can convert to a MauiAsset under the hood with special values), but right now we need something way better than what we have.

0reactions
Eiloncommented, Jan 27, 2022

Notes from meeting with @mattleibow :

  1. Remove “Assets” special folder from Windows targets in Resizetizer to make it consistent with other platforms
  2. Consider updating project template to have MauiAsset glob a. Add glob to template: <MauiAsset Include="Resources/Raw/**" LogicalName="%(RecursiveDir)%(FN)%(EXT)" /> b. Add a sample raw resource “txt” file to “Resources/Raw/asset.txt” --> the content of this file can show the code to read it using Essentials.OpenPackageFileAsync() c. Fix the bug where LogicalName doesn’t work on some platforms
  3. Remove “Assets” path combine workaround from BlazorWebViewHandler on Windows: src\BlazorWebView\src\Maui\Windows\WinUIWebViewManager.cs
  4. Fix up any samples in the MAUI repo to be more consistent with how we expect MauiAssets to be used
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get path to MauiAsset on android
The only thing I can get to work is copying Microsoft's recursive folder include as: <MauiAsset Include="MyFolder\**" ...
Read more >
Target multiple platforms from .NET MAUI single project
A single cross-platform app entry point. .NET MAUI single project is enabled using multi-targeting and the use of SDK-style projects.
Read more >
Opinions on .NET MAUI / what do Xamarin Devs have to say
Clearly it is possible, nothing is impossible, but it is a huge scope of work. Windows could do that as number of people...
Read more >
Start with MAUI
So, the first thing you have to do is download the Visual Studio 2022 Preview installer from the Microsoft website. Then, click on...
Read more >
Playing audio with .NET MAUI - Dave's Tech Blog
Audio uses different types to play audio on iOS/Mac/Windows than I've used, requires you to provide your own transport controls, and doesn't use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found