maui-migration-samples
maui-migration-samples copied to clipboard
[MIGRATION] "Cannot resolve type 'StackLayout'" when attempting to build newly migrated .NET MAUI app.
Hello everyone!
I recently migrated a Xamarin.Forms app to .NET Maui using the guide, and I'm at the final step, where I fix the build errors that show up. The first build error I'm getting is the one in the title: "Cannot resolve type 'StackLayout'." The namespaces were all updated and all intellisense errors were fixed as they were found. I even updated the project properties to match the starter project that is created when you create a new .NET MAUI application in VS 2022. Obviously, a freshly created .NET MAUI project does not have this problem, so I'm more asking for troubleshooting steps. One final note is that the StackLayout is the root element of my view, but this issue is happening with the root elements of all the views in my project, so it's not likely a code issue.
Environment
**Are you on Windows or Mac:**Windows
**Visual Studio Version:**2022 version 17.4.1
**.NET version dotnet --version
:**6.0
**MAUI version installed:**6.0.547
Your code
Is it an app or a library? Both, library + iOS & Android apps. What platforms does it target? Android & iOS Is it Xamarin.Forms? What version? (PS we recommend only migrating XF 5+) Xamarin.Forms 5.0 migrated to .NET MAUI Do you use Xamarin.Essentials? No Is your app/library open source? Share the link! No If it isn't OSS, would you be willing to show someone on our team some code in a video call? No
Migration
Did you follow the steps on the migration wiki Yes Was it successful? No What went wrong? Details please! [ ] 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. Feel free to add screenshots/before + afters, video walkthroughs, blogs, or angry rants. Particularly - what .csproj properties did you get rid of and what could you keep? What code changes did you have to make in your C# and XAML? Followed the steps outlined in the migration guide. Currently on the final step (Fix Build Errors), attempting to fix the error stated in the title. Project properties were updated to match a fresh .NET MAUI project where appropriate. What NuGets do you have that don't work for MAUI yet? N/A
Custom Renderers (optional)
Do you have custom renderers in your app? Did you use the MAUI compat package with them, and did it worK? Did you try to rewrite your renderers to the handler architecture? How did that go?
Upgrade Assistant (optional)
Did you use the upgrade assistant to try to upgrade? Did it work? Assistant did not update the library project in the solution, the iOS and Android projects were upgraded using the assistant and will be tested for errors once build start working.