Reputation: 567
I am working up a new Xamarin.iOS app is VS for Mac with Google AdMob support. Similar to this post and that post. I get
The type or namespace name 'Google' could not be found...
Steps to repro in Visual Studio for Mac are
Open AppDelegate.cs and add the line
using Google.MobileAds;
Build the project.
My VS for Mac is up to date in the stable channel. Xcode and MacOS are up to date.
What is needed to get such a project in VS for Mac to recognize the reference? (I recommend trying proposed solutions on a project created using the repro steps above or trying some other technique in a Xamarin.iOS project in VS for Mac before posting.)
Upvotes: 1
Views: 278
Reputation: 567
It looks like my VS for Mac was messed up (across several dot upgrades, hmmm). After the latest upgrade (to 8.6 build 4520) I started another solution and this time the process of adding NuGet packages and getting references in the project works seamlessly.
Should VS for Mac fail again, a workaround is to edit the .csproj file and add the references manually:
<ItemGroup>
<Reference Include="System" />
...
<Reference Include="Firebase.Core">
<HintPath><your path>\.nuget\packages\xamarin.firebase.ios.core\6.6.6\lib\xamarinios10\Firebase.Core.dll</HintPath>
</Reference>
<Reference Include="Google.MobileAds">
<HintPath<your path>\.nuget\packages\xamarin.google.ios.mobileads\7.57.0\lib\xamarinios10\Google.MobileAds.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
...
<PackageReference Include="Xamarin.Google.iOS.MobileAds">
<Version>7.24.1</Version>
</PackageReference>
</ItemGroup>
Upvotes: 1