This suggested Nuget Client will not install on Visual Studio 2017 for Mac. When I attempt to install, I receive the following error message:
"Could not install package 'Microsoft.OData.Edm 6.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."
The link to this Nuget package is https://components.xamarin.com/view/simple.odata.client.
When trying to install other Nuget packages I receive a similar error message naming a different package as the error source.
It looks like you're mixing a couple of things. The Simple.OData.Client package is not the Microsoft.OData.Edm package. Also you say you link to a NuGet package, put you link to the Xamarin Component Store.
Furthermore, I think you should read up on what PCLs are and how to use them. When I look at the NuGet page for the Microsoft.OData.Edm package I see that it does not support iOS and Android. So, you will never be able to install it to a PCL which targets one of these platforms. You should, however, be able to install the Simple.OData.Client package according to the NuGet page.
PCLs have a certain profile. When you right-click and go to the properties of a PCL library, you can check all platforms that you want it to support. Each combination of platforms have a certain profile, specified by a three digit number, like 111 or 259. The parts of the .NET framework that are available to you, are an intersection of the functionalities that are available on all targeted platforms. If a functionality is supported by iOS but not on Android, it's not supported in your PCL.
This is also why NuGets need to support the specific profile that you are targeting, because it can only use the methods that are available in it.
Related
I want to use a shared class library from my backend API in my Xamarin Forms 5 app. This library mostly contains some util functions and I have it as a NuGet package.
Do I need to install this package on all three projects or just the main project where I have my code and where I'll be using it?
I read some articles and watched some videos and got some conflicting answers. In some cases, packages are installed onto all three projects but other times only onto the main one. I'm sure there's some logic to this. I'd appreciate someone telling me how to determine where to install NuGet packages like mine?
if it's just a .NET library, install it in your .NET project where all the Forms code is
nugets that are installed in multiple projects typically contain multiple libraries - iOS, Android and .NET, and nuget installs the appropriate library in each one
When you install a nuget in Xamarin.Forms is it necessary to do it on every project (project, project.Android and project.IOS)?
Which pros and cons has do it or how I know where I have to intall each of them?
There is no absolute answer, it will depend on the Nuget Package. So you will have to read the information about it before deciding to install it in your project.
What defines this?
Take for example Xamarin.Essentials, it is installed in all the projects because you can call the functions in share code, but the actual implementation is in the platform specific. In this case you even have to call Init in every platform
From Xamarin.Essentials doc
In the Solution Explorer panel, right click on the solution name and
select Manage NuGet Packages. Search for Xamarin.Essentials and
install the package into ALL projects including Android, iOS, UWP, and
.NET Standard libraries.
If you apply platform specific code, you might need some extra Nugets for that code, meaning that you would only add it to your Android or iOS or UWP code
If you have any doubt about where to install the package, you can always ask :) Also if you install an Android package in an iOS project, you surely will get a compiling error.
I am trying to follow a tutorial on consuming web services in Xamarin Forms. I created a fresh project and have tried to install Refit, that didn't work so I tried to install RestSharp. I can install both of these libraries to my Droid / iOS projects, but not to the PCL. I get the following error in Visual Studio:
Could not install package 'Refit 4.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author
Could not install package 'RestSharp 106.2.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author
I've found this post on the xamarin forums, but it didn't fix my issue. My project is fresh, everything is up to date... Does anyone know how I can fix this issue?
vents XF is supposed to make developing cross platform apps faster & easier, but i think I'd have done this poc in native ios/droid twice in the time it's taken me to install a library to a blank project! :)
This happens because RestSharp it's not compatible with PCL-library. So you will have to handle whatever you're trying to do in platform specific.
I am looking to develop a game using cocossharp targeting Mac. When I am trying to add NuGet packages, CocosSharp packages are failing to add with the following error:
Could not install package 'CocosSharp 1.7.1'. You are trying to
install this package into a project that targets
'Xamarin.Mac,Version=v2.0', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
Could someone explain which is the right package or if there was a versioning problem that I am hitting into here.
I also noticed the - http://mono.github.io/CocosSharp/ where I see an issue "#371 CCGameView: Add Mac support" marked to be part of the next release. Does that mean, Cocossharp is currently not supported on Mac?
Has anyone encountered this error when adding the Xamarin.Forms package through the "Add NuGet package" option?
PS I'm using Xamarin Studio and I only encounter this with Windows.
Error message is:
Could not install package 'Xamarin.Forms 2.2.0.31'. You are trying to
install this package into a project that targets
'.NETFramework,Version=v4.5,Profile=Profile78', but the package does
not contain any assembly references or content files that are
compatible with that framework.
Here is the screenshot
You are having a profile which has portable class Profile78.Profiles are the type of your portable class where you select the target projects which can use your PCL. The more you select the less functionality can be provided.
You need to change it to another one. Usually most classes (including Xamarin.Forms) are supporting Profile111. Profile111 is a profile which does not support Silverlight in contast du Profile78. So you need to go to Properties and deselect Windows Phone Silverlight and Silverlight. You can select everything else (.Net 4.5, Windows 8, Windows Phone 8.1, Android, iOS/iOS classic and ASP.NET Core 1).
Then try adding Xamarin.Forms again.
You can see more information with a list of all(?) profiles here.
Here you see how to change in Visual Studio project Properties:
And here in Xamarin Studio project Option:
The problem is that you do not have the Portable Class Library (PCL) profiles installed on Windows. Xamarin.Forms 2.2.0.31 supports Profile78 so changing it to Profile111 will not fix the problem.
The error message itself indicates that this is the problem since it refers to Profile78. If the NuGet package was really incompatible then NuGet would show the frameworks in the PCL profile in its error message not the profile number. If I try to install Xamarin.Forms 2.2.0.31 into a PCL project that targets Profile1 which is not supported by Xamarin.Forms then I get an error:
Could not install package 'Xamarin.Forms 2.2.0.31'. You are trying to install this package into a project that targets 'portable-net40+sl40+win+wp+Xbox40', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Note that Profile1 is not mentioned.
There are detailed instructions on installing Portable Class Libraries for Xamarin Studio which I will summarize here:
To install the Portable Class Libraries on Windows you have three options:
Install Visual Studio 2013 (full or Express version). Update 2 or
above is required.
Install the Portable Library Tools and the Portable Library Reference Assemblies 4.6.
Install the Portable Library Tools and copy the .NETPortable directory from Mono over to Windows.