I'm trying to create a nuget package for a PCL library I've made.
This nuget package is intended to be used in a Xamarin Forms application though. So I'm not even sure if the things I've ticked are correct.
I really only care about .NET Framework 4. That is my bare minimum framework. For the rest, I don't care at all and have no idea what I should be targetting.
For what it's worth, I'm using NuGet Package Explorer to create my NuGet nupkg files to manually test them before I publish them to NuGet.
Here's a screenshot of what I was trying, but Xamarin Studio failed to add the nuget package (saying it wasn't the right something-or-rather).
and the error message from Xam Studio:
Adding Foo...
Adding 'Foo 1.3.0' to Core.
Could not install package 'Foo 1.3.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', 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.
For Xamarin.Forms the two profiles that are good ones for your Portable Class Library (PCL) project to use are Profile 78 or Profile 259. Xamarin.Forms can be used in other profiles but if your PCL project targets one of these you should be OK. Your project looks to be targeting Profile 78.
Here are the Xamarin.Forms PCL profiles for reference.
Xamarin.Forms 1.3:
portable-win+net45+wp80+MonoAndroid10+MonoTouch10
Xamarin.Forms 1.4:
portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
The problem with your NuGet package that it does not indicate that it supports Windows 8 in the PCL. NuGet will look at all the individual frameworks that make up the project's PCL profile (ignoring the Xamarin and Mono ones since they are optional if you do not have them in your NuGet package's PCL profile) and ensure that the NuGet package's PCL profile has a framework which is compatible. If the NuGet PCL does not have a matching framework then NuGet considers it incompatible.
So your NuGet package's portable library folder would need to include win
portable-net4+sl5+wp8+win
Then you can install your NuGet package into your Profile 78 PCL project.
Related
I am writing a crossplatform (iOS and android) Xamarin app and I need a sql connection to my database. I found out that I need System.Data.SqlClient to achieve this. But when I try to add System.Data.SqlClient to my core project I get:
Could not install package 'System.Data.SqlClient 4.4.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', 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 get that apparently this .NETPortable version is compatible, but what is the solution to this? There must be a way to access a SQL database. Also I found that other posts asked to add System.Data first, but this package doesn't even show up in nuget.
In case that you change your pcl project into .NET Standard you should be able to install this nuget package.
Follow this awesome snack pack!
In Visual Studio Preview there is template to create xamarin project using .netstandard. I can confirm that it works.
When I try to install Firebase Messaging Nuget package on the solution it gives me this error -
"Could not install package 'Xamarin.Firebase.Messaging 42.1021.1'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.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."
And for the android installation it says
"Could not install package 'Xamarin.Firebase.Messaging 42.1021.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44', 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."
How do I get it to install?
The solution is to use the latest stable Xamarin.Forms and have your project's compileSdkVersion (so Target Framework) set to 7.0 or higher. You will then be able to install newer versions of Android Support and therefore Google Play Services packages.
Happy coding!!
I recently started to develop android apps with Xamarin for Visual studio, but every time I want to install a Nuget package for C#.Net I get this error Message:
The package "System.Reflection.Extensions 4.0.0" couldn't be installed. You try to install the package into a project, which refers to MonoAndroid,Version=v7.1", the package doesn't contain assemblyreferences or contentfiles, which are compatible with this framework. Contact the Autor of the nuget package for more information.
Is there any way to modify the nugetpackage to match my needs or do I really have to contact the author of the package?
You can't install the Overwatch.Net package because it only targets .NET 4.5.2 and does not contain libraries for either PCL or Xamarin.Android.
Looking at the code for the library, there is no reason it could not be a PCL, so you have 2 options.
Ask the author of Overwatch.NET to make a PCL or NETStandard version of the library
Do the work yourself and convert it
I made library which is nuget availiable. Let's call it A. Now I would like to create other solution which will use this library and extend it's API by adding fluent api.
My library project type (A) is dll portable with targets: .Net Framework 4.5, Windows 8, ASP.NET Core 1.0
Now, I was trying to create another project in different solution(let's call it B) with same targets (still .dll) However, i can't get manage to make it work. When installing A lib by nuget, it throws:
Could not install package 'System.Collections 4.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.
How to fix it?
I have a problem with NuGet installing the "Xamarin.JOSE.JWT" package. I get the following error:
> Could not install package 'Xamarin.JOSE.JWT 1.0.3'. You are trying to
> install this package into a project that targets
> 'MonoAndroid,Version=v6.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.
Is this a known problem or is there a workaround for this?
Xamarin.JOSE.JWT 1.0.3 does not support Xamarin.Android projects. It only contains assemblies for .NET Framework 4.0.
Your options are:
Find another NuGet package that does support Xamarin.Android projects.
See if you can compile the Xamarin.JOSE.JWT project against Xamarin.Android.
Open an issue on the Xamarin.JOSE.JWT GitHub repository.
Try directly referencing the jose-jwt.dll from the NuGet package and see if it works with an Android project. This may not work if it is using parts of the .NET Framework not supported by Xamarin.Android.
Use the Xamarin.JOSE.JWT NuGet package on the server side and not in the Android project.