安装Xamarin.GooglePlayServices相关包时遇AssemblyName元数据缺失错误求助
Hey there, I’ve dealt with this exact metadata error when working with those specific Xamarin Google Play Services NuGet versions before. Let me share the fixes that resolved it for me and other developers:
Clean & Rebuild Your Solution
Start with the simplest fix first: In Visual Studio, right-click your solution > selectClean Solution. Once that finishes, right-click again >Rebuild Solution. Cached build artifacts often get corrupted, and this clears them out to start fresh.Delete the Xamarin Build Download Cache
The error directly points to the cache folder atC:\Users\sp\AppData\Local\XamarinBuildDownloadCache. Navigate to this directory, delete the entireplayservicesbasement-16.2.0folder (and any other related cached AAR folders if you spot them). Restart Visual Studio, then go toTools > NuGet Package Manager > Manage NuGet Packages for Solutionand clickRestoreto re-download the correct files with proper metadata.Align NuGet Package Versions
Mixing mismatched minor versions of Google Play Services packages can trigger metadata issues. Double-check that all your Xamarin.GooglePlayServices.* packages are on a compatible version track. For example, try upgrading/downgrading bothXamarin.GooglePlayServices.BasementandXamarin.GooglePlayServices.Tasksto the same major/minor version set to ensure dependency consistency.Manually Add AssemblyName Metadata (Advanced)
If the above steps don’t work, you can manually edit your project file to fix the missing metadata:- Right-click your Android project >
Unload Project - Right-click the unloaded project >
Edit [YourProjectName].csproj - Look for
RestoreAssemblyResourcesentries referencingplayservicesbasement-16.2.0.aar, and add theAssemblyNameattribute like this:<RestoreAssemblyResources Include="C:\Users\sp\AppData\Local\XamarinBuildDownloadCache\playservicesbasement-16.2.0\playservicesbasement-16.2.0.aar"> <AssemblyName>playservicesbasement</AssemblyName> </RestoreAssemblyResources> - Save the file, reload the project, and rebuild.
- Right-click your Android project >
Update Visual Studio & Xamarin Tools
Outdated IDE or Xamarin Android tools can cause package restoration glitches. Open Visual Studio >Tools > Get Tools and Features, check for updates under theMobile development with .NETworkload, install any available updates, then restart and try again.
内容的提问来源于stack exchange,提问作者Sourav Paria

