maui-migration-samples
maui-migration-samples copied to clipboard
[MIGRATION] Build error on Android project
Environment
Windows
Visual Studio Version:
17.3.5
.NET version dotnet --version
:
6
MAUI version installed:
6.0.536
Your code
Is it an app or a library? App What platforms does it target? Android
Migration
Did you follow the steps on the migration wiki Yes Was it successful? No What went wrong? Details please! Build error [ ] I couldn't finish the steps [ x] It didn't build after I finished migrating [ ] I need NuGets that aren't compatible with MAUI yet [ ] It built, but the layout/UI is all messed up [ ] I have no idea what happened, please help!!!
Share some details on your migration.
3>.....Android\obj\Debug\net6.0-android\Resource.designer.cs(11,12,11,61): error CS0579: Duplicate 'global::Android.Runtime.ResourceDesignerAttribute' attribute
Same issue as described here
Looking for help on what the cause of this issue might be. Happy to provide more details, let me know.
Basically this has something to do with how existing Android project resources should be handled, which the migration steps don't cover.
In the shared project, I added an Images folder within the Resources folder. I then added a bunch of my .png images, ensuring the Build Action is MauiImage. In my shared project .csproj file I have:
<ItemGroup> <MauiImage Include="Resources\Images\*" /> </ItemGroup>
I am getting this build error for most of the images: 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.476\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'C:\Users...\obj\Debug\net6.0-android\res\images\imagename.png'.
I updated to VS 17.3.6 - Maui 6.0.541. Cleaned out my bin and obj folders for all projects. This is still happening.