jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
650 stars 152 forks source link

Version 8 cannot be build against net8.0 #638

Closed vlasto77 closed 5 days ago

vlasto77 commented 2 weeks ago

Version 8 does not support net8.0 anymore. I need to target net8.0 to be able to run unit tests. However when my ptoject targets also net8.0 I cannot upgrade library to version 8.

jamesmontemagno commented 2 weeks ago

try 9.0-beta

jamesmontemagno commented 2 weeks ago

would need to know your version of .net maui and what errors you are getting

vlasto77 commented 2 weeks ago

I§m getting following error:

Error NU1202 Package Plugin.InAppBilling 8.0.4 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package Plugin.InAppBilling 8.0.4 supports:

da-ms-22 commented 1 week ago

I experienced the same issue, and the error message is the same as vlasto77's.

Some additional information. The package is only added to target Android after installation.

`

8.0.4

`

If add the package manually in project file like below, above mentioned error message occurs.

`

8.0.4

`

The latest ios target framework is net8.0-ios17.5. And the message says it wants net8.0-ios18.0.

david-maw commented 1 week ago

Same problem as @vlasto77, happens with 9.0-beta too. I notice that according to the information the NuGet Solution UI shows me, 7.1.3 says it has a dependency on ".NETStandard, Version=v2.0" but 8.0.0-beta and beyond do not (as well as depending on net8.0... rather than 6.0... ).

Why use a net8.0 platform (as opposed to, say. net8.0-android)? It's because that seems to be needed to persuade unit tests to work.

GioviQ commented 1 week ago

Plugin.InAppBilling 8.0.4 works fine in my project with <TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks> No compilation errors with last version of Visual Studio and after donet workload update My first test with sandbox account in iOS 18.0.1 is working: the subscription is successful

tecomunico commented 1 week ago

Same problem as @vlasto77, any solution ?

david-maw commented 1 week ago

If it helps, with 8.0.4 I see this at the developer command prompt:

PS > dotnet build .\DivisiBill\DivisiBill.csproj -c:Debug -f:net8.0
...\DivisiBill.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.7.0.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.1 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.3.1 was resolved.
...\DivisiBill.csproj : error NU1202:
  Package Plugin.InAppBilling 8.0.4 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package Plugin.InAppBilling 8.0.4 supports:
    - net8.0-android34.0 (.NETCoreApp,Version=v8.0)
    - net8.0-ios18.0 (.NETCoreApp,Version=v8.0)
    - net8.0-maccatalyst18.0 (.NETCoreApp,Version=v8.0)
    - net8.0-macos15.0 (.NETCoreApp,Version=v8.0)
    - net8.0-windows10.0.19041 (.NETCoreApp,Version=v8.0)

With 7.1.3 it builds just fine.

ivmirx commented 5 days ago

would need to know your version of .net maui and what errors you are getting

Hi @jamesmontemagno! I guess most of us in this thread do not use .NET MAUI directly, but instead have a ".NET class library + Multiple platform-specific projects" setup with something like MvvmCross underneath and native UIs on each platform. This approach pushes most of the app's logic into the .NET class library project which is platform-agnostic.

jamesmontemagno commented 5 days ago

@ivmirx gotcha gotcha, yeah there was a re-architecture for v8, but this should be doable... let me look at it.

jamesmontemagno commented 5 days ago

Can you try 8.0.5-beta and let me know. This has the stub for net8.0 in there now like we used to have for netstandard and can be used in a .NET 8 class library

ivmirx commented 5 days ago

Can you try 8.0.5-beta and let me know. This has the stub for net8.0 in there now like we used to have for netstandard and can be used in a .NET 8 class library

Many thanks, it builds! I only had to replace billing.FinalizePurchaseAsync(purchase.PurchaseToken); with billing.FinalizePurchaseAsync(new[] { purchase.TransactionIdentifier }); for Android.

jamesmontemagno commented 5 days ago

yay! i will push out a new 9.0 beta as well

david-maw commented 5 days ago

I am using MAUI and it worked for me too, with the same update to FinalizePurchaseAsync. Though I did get the warning:

NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.7.0.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.7.0.1 && < 2.7.1) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.6 was resolved.
jamesmontemagno commented 2 days ago

Yeah the nuget versions are a bit funky based on which service release you are using, but probably should be alright...

I actually request 2.8.3.1 in v8 in v9 i request 2.8.6 because these are the dependencies of billingclient.

Make sure you have the latest service release for .NET MAUI