创建Xamarin.Forms可移植空白项目遇警告,更新VS后问题加剧求解决及教程
Hey there, I’ve run into similar Xamarin headaches after VS updates before, so let’s break this down and get you back on track!
Fixing Warnings & Post-VS-Update Issues with Portable Xamarin.Forms Projects
Let’s start with the technical problems first—here are the most reliable fixes I’ve used:
Clean & Rebuild Your Solution
VS updates often leave behind cached build artifacts that cause weird warnings. Right-click your solution → selectClean Solution, thenRebuild Solution. This alone fixes 30% of random Xamarin issues for me.Consolidate NuGet Packages
Mismatched package versions are the #1 cause of PCL project warnings, especially after a VS update:- Right-click your solution →
Manage NuGet Packages for Solution - Switch to the
Consolidatetab—you’ll see any packages with conflicting versions across your projects - Update all Xamarin-related packages (like Xamarin.Forms, Xamarin.Essentials) to the same stable version (avoid preview builds unless you’re testing new features)
- Uninstall any outdated or unused packages, then restart VS
- Right-click your solution →
Switch from PCL to .NET Standard (If Possible)
Portable Class Libraries (PCL) are pretty outdated now, and newer VS versions have limited support for them. Try migrating your project to .NET Standard 2.0:- Right-click your PCL project →
Properties - Under the
Librarytab, change the target framework to.NET Standard 2.0 - VS will handle most of the migration automatically, and this should eliminate many compatibility warnings post-update
- Right-click your PCL project →
Reset VS User Data
If all else fails, resetting VS’s user data can fix deep-seated configuration issues:- Close VS completely
- Open Command Prompt as Administrator
- Run this command:
devenv /resetuserdata - Restart VS and try creating a new project again
Recommended Xamarin Learning Resources
Here are my go-to resources for learning Xamarin, no external links needed:
Official Microsoft Documentation
Start with the "Get Started" section and "Xamarin.Forms Fundamentals"—it’s the most authoritative source, with step-by-step guides for building your first app, working with UI layouts, data binding, and cross-platform features.Hands-On Project Tutorials
Build small, practical apps like a to-do list or weather app. The official "Build a Xamarin.Forms App" series walks you through every part of the process, from setting up your project to deploying to iOS/Android.VS Learn Panel Videos
Open Visual Studio, click the "Learn" tab on the left sidebar—there are free, official video tutorials covering everything from basic Xamarin.Forms concepts to advanced topics like MVVM and dependency service.Open Source Samples on GitHub
Search for "Xamarin.Forms samples" on GitHub to find official Microsoft samples or high-star community projects. Studying real-world code is a great way to learn best practices and solve specific problems.
内容的提问来源于stack exchange,提问作者Mjr

