dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Conflicting assets with the same target path '_framework/blazor.modules.json' when building 2nd dependency MAUI Blazor class libraries #25999

Open datvm opened 2 days ago

datvm commented 2 days ago

Description

When building a MAUI Blazor class library project (Microsoft.NET.Sdk.Razor) like this, I receive this error:

MultipleMauiLibs.Lib1 depends on public Nuget package BlazorMaterialWeb.Bundled. MultipleMauiLibs.Lib2 depends on MultipleMauiLibs.Lib1.

I suspect it has something to do with https://github.com/dotnet/maui/issues/15234. I am sure my project could build before, probably with .NET 8.0.402. I tried uninstall my .NET SDK and reinstall it but with the workload installed the latest, I can't find out the version this issue begins (I do not know how to install a previous workload version).

Full error message:

Conflicting assets with the same target path '_framework/blazor.modules.json'. For assets 'Identity: C:\Users\lukev\source\repos\MultipleMauiLibs\MultipleMauiLibs.Lib1\obj\Debug\net8.0-android\jsmodules\jsmodules.build.manifest.json, SourceType: Project, SourceId: MultipleMauiLibs.Lib1, ContentRoot: C:\Users\lukev\source\repos\MultipleMauiLibs\MultipleMauiLibs.Lib1\obj\Debug\net8.0-android\jsmodules\, BasePath: /, RelativePath: _framework/blazor.modules.json, AssetKind: Build, AssetMode: CurrentProject, AssetRole: Primary, AssetRole: , AssetRole: , RelatedAsset: , AssetTraitName: JSModule, AssetTraitValue: JSModuleManifest, Fingerprint: rwgk8v7aty, Integrity: m2YidR3qJEUQ6rEG2+yPsHcAXxc8hJ+UFYOLFiDAhVc=, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: C:\Users\lukev\source\repos\MultipleMauiLibs\MultipleMauiLibs.Lib1\obj\Debug\net8.0-android\jsmodules\jsmodules.build.manifest.json' and 'Identity: C:\Users\lukev\source\repos\MultipleMauiLibs\MultipleMauiLibs.Lib2\obj\Debug\net8.0-android\jsmodules\jsmodules.build.manifest.json, SourceType: Computed, SourceId: MultipleMauiLibs.Lib2, ContentRoot: C:\Users\lukev\source\repos\MultipleMauiLibs\MultipleMauiLibs.Lib2\obj\Debug\net8.0-android\jsmodules\, BasePath: /, RelativePath: _framework/blazor.modules.json, AssetKind: Build, AssetMode: CurrentProject, AssetRole: Primary, AssetRole: , AssetRole: , RelatedAsset: , AssetTraitName: JSModule, AssetTraitValue: JSModuleManifest, Fingerprint: rwgk8v7aty, Integrity: m2YidR3qJEUQ6rEG2+yPsHcAXxc8hJ+UFYOLFiDAhVc=, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: obj\Debug\net8.0-android\jsmodules\jsmodules.build.manifest.json' from different projects.

Steps to Reproduce

No response

Link to public reproduction project repository

https://github.com/datvm/MultipleMauiBlazorLib

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, macOS, iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Zhanglirong-Winnie commented 2 days ago

This issue has been verified using Visual Studio 17.13 Preview 1(9.0.10 & 8.0.100 & 8.0.83). Can repro this issue on all platforms. And 8.0.82 works fine.

datvm commented 1 day ago

@Zhanglirong-Winnie hi, I really need to build my project. Could you tell me how I can install that version please?

Zhanglirong-Winnie commented 1 day ago

Hi, @datvm You can change the MAUI controls version to 8.0.82, or lower. Image Image

datvm commented 1 day ago

Thank you very much! I can finally build my project by pinpointing MauiVersion for now. Hope this is fixed soon.

<MauiVersion>8.0.82</MauiVersion>

As we plan to skip .NET 9 and wait for .NET 10, I assume we will have to pinpoint that version until .NET 10 is released? Or if there is a fix, will it get backported to .NET 8?