SimpleStorage icon indicating copy to clipboard operation
SimpleStorage copied to clipboard

.Net Standard

Open MaxThom opened this issue 5 years ago • 9 comments

Hi,

I'm looking to use your plugin and I cant get my project to start. I get this error :

Severity	Code	Description	Project	File	Line	Suppression State
Error		Can not resolve reference: `PerpetualEngine.SimpleStorage.Desktop`, referenced by `LightYourHearth`. Please add a NuGet package or assembly reference for `PerpetualEngine.SimpleStorage.Desktop`, or remove the reference to `LightYourHearth`.	LightYourHearth.Android			

I added the nuget in my shared library and in the Android project. I also added the required line in the MainActivity.. Is is because of .NetFramework vs Standard ?

Ty If you have a solution or fix.

MaxThom avatar Aug 24 '20 14:08 MaxThom

The package must be added to any project which uses the SimpleStorage lib. It looks like the build error happens in your NUnit testing project. Have you added the lib there?

rodja avatar Aug 25 '20 04:08 rodja

I dont have any NUnit project. I added the library to the shared library and the android.

MaxThom avatar Aug 26 '20 17:08 MaxThom

Same problem. Package installed in all projects. 1

Using code in shared project App.xaml.cs image

Error when trying to compile image

Silver7899 avatar Aug 28 '20 07:08 Silver7899

Could you attach the csproj of your shared library? We normally use shared projects (.shproj with .projitems) which do not have the ability to add libraries by themself (see https://docs.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/shared-projects?tabs=macos). Do you have any particular requirement why you want to use a shared lib?

rodja avatar Aug 28 '20 11:08 rodja

Sorry maybe I'm confused about terminology because I'm a beginner

I tried using blank Xamarin Forms template. Using your library code in a shared project (not in a shared library)

App1.zip

Silver7899 avatar Aug 28 '20 11:08 Silver7899

The project you added has a netstandard2.0 library for the shared code. When I create a blank Forms App I'll get a shared project (see screenshot). Unfortunately we currently have not time to add support for netstandard2.0 libs. I suggest you use a shared project. You should be able to just delete your lib project and add a shared project instead.

rodja avatar Aug 29 '20 05:08 rodja

I am getting the same error using the version 1.4.27. In my project netstandard2.0 libs are also used, no shared project. As far as I read the description for 1.4.27, it supports now the net2.0, doesn't it? Thanks.

selimgueler avatar Oct 05 '20 17:10 selimgueler

I added the net2.0 target but as you wrote that still does not work. Is it possible for you to switch to a shared project as Xamarin recommends?

rodja avatar Oct 06 '20 09:10 rodja

Thanks for the feedback. Unfortunately it is a little late for that, project almost done :-) However I've solved my issue with Xamarin.Essentials.Preferences.

Thank you again.

Grüße

selimgueler avatar Oct 06 '20 13:10 selimgueler