Closed mrhery closed 8 months ago
The library works fine on .NET 7, and I can confirm it works also in .NET 8.
Could you please share more details of the issue along with a reproduction sample?
🙂 thank you 🙂
Hello, I also have a problem with .Net7. When I add the packages I get an exclamation mark on the packages and I can't use the namespace in a using. I have already tried restore and the like
If you would like to use Crashlytics then you don't have to install Plugin.Firebase. Install only the packages you need for.
Hello, I also have a problem with .Net7.
When I add the packages I get an exclamation mark on the packages and I can't use the namespace in a using.
I have already tried restore and the like
For example:
<ItemGroup>
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Crashlytics" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Analytics" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Firestore" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Auth" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Core" Version="2.0.1" />
</ItemGroup>
On the nuget package manager, the Plugin.Firebase
installation page, it said the dependencies are net6.0
, net6.0-android31
, net6.0-ios16.1
. I tried to switch with other version also doesn't shows availability for dependecies .NET 7. If I click on install, the error occurs on the net6.0-ios
. Heres the package manager replies:
Restoring packages for J:\repos\MAUINotificationApp\MAUINotificationApp\MAUINotificationApp.csproj...
GET https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.installations/index.json
GET https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.cloudfirestore/index.json
OK https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.cloudfirestore/index.json 265ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.cloudfirestore/8.10.0.3/xamarin.firebase.ios.cloudfirestore.8.10.0.3.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.cloudfirestore/8.10.0.3/xamarin.firebase.ios.cloudfirestore.8.10.0.3.nupkg 12ms
OK https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.installations/index.json 287ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.installations/8.10.0.3/xamarin.firebase.ios.installations.8.10.0.3.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.firebase.ios.installations/8.10.0.3/xamarin.firebase.ios.installations.8.10.0.3.nupkg 12ms
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\User\.nuget\packages\xamarin.firebase.ios.installations\8.10.0.3\lib\net6.0-ios15.4\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simulator\FirebaseInstallations.framework\Headers\FIRInstallationsAuthTokenResult.h'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path)
at NuGet.Packaging.StreamExtensions.Testable.MmapCopy(Stream inputStream, String fileFullPath, Int64 size)
at NuGet.Packaging.StreamExtensions.Testable.CopyToFile(Stream inputStream, String fileFullPath)
at NuGet.Packaging.PackageFileExtractor.ExtractPackageFile(String source, String target, Stream stream)
at NuGet.Packaging.PackageArchiveReader.CopyFiles(String destination, IEnumerable`1 packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken token)
at NuGet.Packaging.PackageReaderBase.CopyFilesAsync(String destination, IEnumerable`1 packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken cancellationToken)
at NuGet.Packaging.PackageExtractor.<>c__DisplayClass5_0.<<InstallFromSourceAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
....
I have tried stps in this GitHub documentation, but still not working:
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
....
</PropertyGroup>
....
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.12.0.2" />
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.0.1" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.6.0.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Crashlytics" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Analytics" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Firestore" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Auth" Version="2.0.3" />
<PackageReference Include="Plugin.Firebase.Core" Version="2.0.1" />
</ItemGroup>
The build is succeeded without error, but to include these:
using Firebase.Auth;
#if IOS
using Plugin.Firebase.Core.Platforms.iOS;
#else
using Plugin.Firebase.Core.Platforms.Android;
#endif
The package Firebase.*
and other Plugin.*
could not be found. I have try a few workaround on Xamarin with net6-android/ios and MAUI net6-android/ios, it works well.
I'm trying to implement push notifications for MAUI dotnet 8 - and seem to be struggling with some of the same issues as above.
I've tried using the whole (Plugin.Firebase(2.0.9))-package and the push specific packages (Plugin.Firebase.CloudMessaging(2.0.4) and Plugin.Firebase.Core(2.0.1)), but keep getting the same error:
The type or namespace name 'Platforms' does not exist in the namespace 'Plugin.Firebase.Core' (are you missing an assembly reference?)
Is the documentation not up to date, or am I missing something?
Struggling with the same here, trying to make it work with .net 7 but nothing i try seems to fix the "Firebase" and Plugin" references error. I based my code in both playground and Fcm project
I ended up here:
and it seems that:
View > Terminal: "dotnet restore" fixed all the references problems.
I have another error now:
Could not find a part of the path '....nuget\packages\xamarin.firebase.ios.remoteconfig\8.10.0.3\lib\net6.0-ios15.4\Firebase.RemoteConfig.resources\FirebaseRemoteConfig.xcframework\ios-arm64_x86_64-simulator\FirebaseRemoteConfig.framework\Headers\FirebaseRemoteConfig-umbrella.h'.
And this in the android project:
@AdriVergara glad you got it working. Yeah! This amazing plugin works very very good in .NET MAUI 7 and 8. I have been using it on production apps.
To fix that AndroidX Browser issue please follow this:
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.6.0.2" />
Just make sure you add it for Android only:
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
...
</ItemGroup>
Thank you for the fast reply! I added what you suggested and it looks like i have it compiling successfully now (I had to dotnet restore again by the way). Thanks again!!
Thanks @AdriVergara for confirming. @mrhery if you also fixed the issue, please feel free to close this issue otherwise post more details of the issue you are facing, so we can try to help you 😎👍🏻.
I managed to get it running as well with removing net8.0-ios and net8 from TargetFrameworks
Well, might not be time to celebrate yet - I have the same experience when trying to do the same for iOS :P
Well, might not be time to celebrate yet - I have the same experience when trying to do the same for iOS :P
Share your csproj file in a gist and the error you are facing. Or even better a repo with the error will help a lot. Please 🙂
I'm struggling to make it work in iOS too, could compile on Android with no need of removing the ios target framework. But on iOS i have some other errors nuget related of type "Could not copy "nuget" to ..."
This is my current csproj:
I appreciate any kind of help :)
`
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst;net7.0-windows10.0.22000.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>X.X</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>X</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>X</ApplicationId>
<ApplicationIdGuid>X</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<NeutralLanguage>en</NeutralLanguage>
<DefaultLanguage>Ca</DefaultLanguage>
<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<PackageCertificateThumbprint>X</PackageCertificateThumbprint>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppInstallerUri>C:\X</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<MtouchDebug>True</MtouchDebug>
<BuildIpa>False</BuildIpa>
<MtouchFloat32>False</MtouchFloat32>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchUseLlvm>False</MtouchUseLlvm>
<MtouchDebug>True</MtouchDebug>
<BuildIpa>False</BuildIpa>
<MtouchFloat32>False</MtouchFloat32>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net7.0-ios'">
<CodesignKey>X</CodesignKey>
<CodesignProvision>X</CodesignProvision>
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net7.0-ios'">
<EnableAssemblyILStripping>False</EnableAssemblyILStripping>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-android|AnyCPU'">
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
<AndroidPackageFormat>apk</AndroidPackageFormat>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\icon_logo_white.svg" Color="#003E6E" ForegroundScale="0.65" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\X.svg" Color="#003E6E" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\exit.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</MauiImage>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<MauiImage Remove="Resources\Images\splash2.svg" />
</ItemGroup>
<ItemGroup>
<None Remove="Platforms\Android\google-services.json" />
<None Remove="Platforms\Android\Resources\values\file_path.xml" />
<None Remove="Platforms\iOS\GoogleService-Info.plist" />
<None Remove="Resources\Images\exit.png" />
<None Remove="Resources\Images\exit.svg" />
<None Remove="Resources\Images\fingerprint.png" />
<None Remove="Resources\Images\fingerprint100.png" />
<None Remove="Resources\Images\left.png" />
<None Remove="Resources\Images\lock.png" />
<None Remove="Resources\Images\logodragfull.png" />
<None Remove="Resources\Images\logodragfulldeveloper.png" />
<None Remove="Resources\Images\phone.png" />
<None Remove="Resources\Images\side_nav_bar2.png" />
<None Remove="Resources\Images\signature.png" />
<None Remove="Resources\Images\splash2.svg" />
<None Remove="Resources\Splash\logowhite.svg" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="MVVM\View\ConfigurarBiometriaView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="MVVM\View\CondicionesLegalesView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Tools\ActivityIndicator\Spinner.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Tostada.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
<ItemGroup>
<Compile Update="MVVM\View\ConfigurarBiometriaView.xaml.cs">
<DependentUpon>ConfigurarBiometriaView.xaml</DependentUpon>
</Compile>
<Compile Update="Platforms\Android\Services\FingerPrintServices.cs">
<ExcludeFromCurrentConfiguration>true</ExcludeFromCurrentConfiguration>
</Compile>
<Compile Update="Platforms\iOS\Services\DeviceKeyServices.cs">
<ExcludeFromCurrentConfiguration>false</ExcludeFromCurrentConfiguration>
</Compile>
<Compile Update="Resources\Strings\StringResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>StringResources.resx</DependentUpon>
</Compile>
<Compile Update="Tools\ActivityIndicator\Spinner.xaml.cs">
<DependentUpon>Spinner.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AdysTech.CredentialManager" Version="2.6.0" />
<PackageReference Include="AsyncAwaitBestPractices" Version="6.0.6" />
<PackageReference Include="CommunityToolkit.Maui" Version="6.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Plugin.Fingerprint" Version="3.0.0-beta.1" />
<PackageReference Include="System.Security.Permissions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="2.0.4" />
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="Xamarin.Firebase.iOS.Core" Version="8.10.0.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="Platforms\Android\Resources\values-ca\" />
<Folder Include="Platforms\Android\Resources\values-eu\" />
<Folder Include="Platforms\Android\Resources\values-gl\" />
<Folder Include="Platforms\Android\Resources\values-es\" />
</ItemGroup>
<ItemGroup>
<GoogleServicesJson Include="Platforms\Android\google-services.json" />
<GoogleServicesJson Include="Platforms\iOS\GoogleService-Info.plist" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Strings\StringResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
`
@AdriVergara I think the issue is that you are including on the project the package:
<PackageReference Include="Xamarin.Firebase.iOS.Core" Version="8.10.0.3" />
I think you need to remove it from the csproj, close visual studio, open the solution again and rebuild the project. Please find below how I have setup my csproj file using .NET MAUI 8 as example:
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Core" Version="8.0.3" />
<PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.3" />
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="2.0.4" />
<PackageReference Include="Plugin.Firebase.Crashlytics" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Analytics" Version="2.0.2" />
<PackageReference Include="Plugin.Firebase.Firestore" Version="2.0.5" />
<PackageReference Include="Plugin.Firebase.Auth" Version="2.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Plugin.Firebase.Core" Version="2.0.1" />
<PackageReference Include="Plugin.Firebase.Functions" Version="2.0.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.12.0.2" />
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.0.1" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.6.0.2" />
</ItemGroup>
Also, this seems to be an issue with the project configuration itself, this is not related with the plugin our friend @TobiasBuchholz created. I'm on Discord as vhugo_ if you are also on Discord, we can chat there to review the issue together.
I think our issue is caused by targeting net8 in <TargetFrameworks>
(<TargetFrameworks>net8.0-android;net8.0-ios;net8</TargetFrameworks>
.
When we build for iOS/Android it also builds for net8(at least in Rider), causing it to fail.
The documentation states to include seperate packages based on target: `#if IOS using Plugin.Firebase.Core.Platforms.iOS;
using Plugin.Firebase.Core.Platforms.Android;
A simple workaround is to change this to: `#if IOS using Plugin.Firebase.Core.Platforms.iOS;
using Plugin.Firebase.Core.Platforms.Android;
I can see
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
<PackageReference Include="Xamarin.Firebase.Messaging" Version="123.0.8" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-ios'">
<PackageReference Include="Xamarin.Firebase.iOS.CloudMessaging" Version="8.10.0.3" />
</ItemGroup>
here https://github.com/TobiasBuchholz/Plugin.Firebase/blob/development/src/CloudMessaging/CloudMessaging.csproj . Maybe that can cause problem with using Plugin.Firebase lib for .net7 and .net8 frameworks?
No, these are only the package references to the xamarin bindings of the native libraries. The plugins target frameworks are net6.0;net6.0-android;net6.0-ios
, which means it supports .net6 and above.
Hi @vhugogarcia , Can you please share a simple working .net 8 maui project?
Another long filenames issue https://github.com/TobiasBuchholz/Plugin.Firebase/issues/240#issuecomment-1889938825
Seems this library works on .net6 but not .net7. Downgrading from .net7 to .net6 should be the solution since .net6 has limitation in supported android sdk version.