Closed Lubendo closed 1 year ago
Hi, as stated in the setup instructions you just need to put the following code into your .csproj file:
<!-- in your case you need to use 'net7.0-android' instead of 'net6.0-android' -->
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<GoogleServicesJson Include="google-services.json" />
</ItemGroup>
You can also take a look at the .csproj file of the sample project for further reference. Hope this helps!
Thanks for you quick reply, with your help I managed to make it work. After adding the google-services.json do not touch it!!! Close Visual studio, open your .csproj and edit like this (not all lines, only those one I think should be mentioned):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-ios;net7.0-android</TargetFrameworks>
<!-- HERE COMES YOUR PROJECT OPTIONS -->
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
</PropertyGroup>
<!-- ios entitlements -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net7.0-ios'">
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<!-- nuget packages -->
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="4.0.0" />
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="3.0.0" />
<PackageReference Include="Plugin.Firebase" Version="1.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk7" Version="1.8.0.1" ExcludeAssets="build;buildTransitive" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.8.0.1" ExcludeAssets="build;buildTransitive" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<GoogleServicesJson Include="google-services.json" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-ios'">
<BundleResource Include="GoogleService-Info.plist" />
</ItemGroup>
</Project>
Hope somebody will find this helpful.
Hello guys,
I lost a day figuring out how to set the BuildAction for my google-services.json to GoogleServicesJson in my MAUI project targeting .NET7. No idea how to get it working... I cannot set the targe to .NET6 just because I need maps in my app.
Thanks for any suggestions.