Open Divyesh-Bhatt opened 9 months ago
Hi @Divyesh-Bhatt. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Sample code to reproduce the issue: https://github.com/divyesh008/TestLib_011124.git
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
I created this targets file that you can download and reference: https://github.com/mattleibow/PackagingMauiAssets/blob/main/MauiLibrary/PackMauiAssets.targets
The main cause of this issue is that the dotnet pack
process does not know how to do anything with the maui assets, so just ignores them. Even if you add it to the package, you also need a targets file that brings them back into projects.
My linked targets file will make sure to generate all the required targets files as well.
We are still looking for a more reliable way to make this happen automatically.
This bug also affects Windows platform.
I created a Maui library project with inside a custom control based on @Eilon HybridWebView; html/js code is inside Resources/Raw folder as suggested. If the custom control is used in another Maui project which has a reference to the Maui library project, everything works fine. If the custom control is used in another Maui project which uses the NuGet of the Maui library project, a 404 error page appears.
@mattleibow targets file works and solves the issue for Windows platform, thank you! 🎉🎉🎉
@mattleibow this solution as well as the one from https://github.com/dotnet/maui/issues/10019 works well only if NuGet is used in a single project. When a project that consumes NuGet is set as a dependency of other project, it won't compile prompting error:
One or more duplicate file names were detected. All image output filenames must be unique: [...] C:\Users\User\.nuget\packages\microsoft.maui.resizetizer\8.0.91\buildTransitive\Microsoft.Maui.Resizetizer.After.targets 631
Description
I am developing a library project of custom controls for .Net MAUI and my controls uses SVG images. When I reference my library project in another project, the svg images I have in my library project are not showing up.
It gives this exceptions in:
Android exception:
iOS exception:
I found this ticket #10019 so followed it. Now image get added to nuget in buildTrasitive folder, but its not showing up in the page where I'm consuming it.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/divyesh008/TestLib_011124.git
Version with bug
8.0.3
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
7.0.101
Affected platforms
iOS, Android
Affected platform versions
All
Did you find any workaround?
Add no_records.svg file in the project where I want to use custom control using library project.
Relevant log output
No response