parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
323 stars 261 forks source link

Isuues with PCL version 1.7 #303

Closed stephenhauck closed 4 years ago

stephenhauck commented 5 years ago

I am using VS 2017 Community 15.9.3 I have a Xamarin.Forms .NET standard app targeting iOS and Android I can add the reference just fine even without the compatibility entry. I can compile fine too ... As soon as I add Parse code to the .NET standard project in a class the Android project fails to find the .NET Standard project reference OR Parse on compile ?

Here is the error .. Severity Code Description Project File Line Suppression State Error Can not resolve reference: Parse, referenced by MyAppName. Please add a NuGet package or assembly reference for Parse, or remove the reference to MyAppName. MyAppName.Android

Even if I add this it makes not difference ...

$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8

Am I missing something somewhere ?

stephenhauck commented 5 years ago

I found this ... anyone having an issue similar to mine ? https://stackoverflow.com/questions/45569378/upgrading-to-net-core-2-0-packagetargetfallback-and-assettargetfallback-cannot

TheFanatr commented 5 years ago

To clarify, are you using the official Parse SDK 1.7 off NuGet? If so, could you try removing the reference and adding it again, then cleanin. The project? Also, note that if you are referencing version 1.7 from a .NET Standard library, you must reference the platform-specific package for the project that uses that library.

TheFanatr commented 5 years ago

Note that the platform-specific packages are not on NuGet and need to be built from source. There may be a better way to do this such as referencing Parse from both the library and the project that uses it and making sure that Xamarin doesn't strip it out.

stephenhauck commented 5 years ago

Thanks for the response... Yes, I am using the NuGet interface in VS2017. I have tried to add the package to the solution and then to the individual projects as well I am using a .NET standard library (2.0), I cannot find the old project from a year or so ago but I do believe that I had previously used the compatibility entry in the .NET standard library project and it used the PCL version (1.7) just fine.

You mentioned referencing it from the projects .. In the Android project in the MainActivity.cs I put the follow code: ParseClient.Configuration tmp = new ParseClient.Configuration(); This did not work... I also tried this ... ParseClient.Initialize(new ParseClient.Configuration { ApplicationId = "{my id here}", WindowsKey = "{my key here}", Server = "https://parseapi.back4app.com" });

Either of those should have forced the inclusion, correct ?

TheFanatr commented 5 years ago

Yes, it should have. To clarify, does it work as expected on iOS? Could you attempt to build only that project and see if it runs? I will look into testing this myself. Temporarily, however, you could try simply implementing your business logic as utility and/or extension methods in the common, library, referencing Parse, but not initializing it, then just referencing those methods where needed in the platform projects. You could also try referencing the assembly built by the master branch of this repository, as it targets .NET Standard 2.0 as well, but you will lose push notification support. Also, is your project upgraded from PCL, or recently created?

stephenhauck commented 5 years ago

I will try to run it just on iOS. I has been .NET standard from the start. I tried to use the .NET standard version but it seems to not be ready for prime time yet.

Stephen

On Dec 26, 2018, at 8:37 PM, Alex Fanat notifications@github.com wrote:

Yes, it should have. To clarify, does it work as expected on iOS? Could you attempt to build only that project and see if it runs? I will look into testing this myself. Temporarily, however, you could try simply implementing your business logic as utility and/or extension methods in the common, library, referencing Parse, but not initializing it, then just referencing those methods where needed in the platform projects. You could also try referencing the assembly built by the master branch of this repository, as it targets .NET Standard 2.0 as well, but you will lose push notification support. Also, is your project upgraded from PCL, or recently created?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stephenhauck commented 5 years ago

Sorry had family visiting. I tried to run the iOS project. It builds and runs but then throws the error below I have version 1.7 referenced in both the .NET standard library and the iOS project. _Unhandled Exception:

System.IO.FileNotFoundException: Could not load file or assembly 'Parse, Version=1.7.0.0, Culture=neutral, PublicKeyToken=ba48c3a442de616e' or one of its dependencies. occurred_

I put this in AppDelegate and still the same error static void IncludeReferences() { Console.WriteLine(typeof(Parse.ParseObject)); }

stephenhauck commented 5 years ago

Bump ... anyone ??

stephenhauck commented 5 years ago

OK so I added a UWP project to the solution and interestingly enough it works ....

TobiasPott commented 4 years ago

This issue is outdated due to the SDK version used. The problem described should no longer occur when using the latest version of the SDK with Xamarin for iOS or Android. If you encounter this problem with the latest version (2.0 from the master branch) feel free to create a new issue to discuss possible solutions.