Xamarin can not install NuGet packages: profile 259 error - c#

I am developing a cross-platform Xamarin app. When I install new packages using the NuGet package manager, the console shows this error:
Could not install package 'X' You are trying to install this package
into a project that the target .NetPortable, Version=4.5, Profile=259
but the package does not contains any assembly references
I know that Profile 259 is generally used for WP or Silverlight based packages. I tried to change configurations on the Properties → Library → Change tab, but this time the system shows:
Project target cannot to be changed.The selected target require
nuget 3.0
How can I solve this problem?
Here's the image of the last error message dialog.

If you look at the NuGet definition for this item:
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.WebHost/
It only supports net45. Thus it cannot install into Profile259.
To be able to install to Profile259 it would need to have a target framework of portable-net45+win8+wpa81+wp8 or netstandard1.0.

Related

Emgu error when trying to install emgu.CV.runtime.windows in VC# 2017

I'm trying to install emgu.CV.runtime.windows from within Visual Studio 2017, and installing by the recommeded method of right-clicking references and installing via NuGet.
However I am getting the error below.
Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets .NETFramework,Version=v4.7.2, 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.
According to the package information, its dependencies are
enter code here.NetStandardVersion=2.0
enter code here.Engu.CV (> 4.5.1 && < 4.5.2)
enter code here.Engu.runtime.windows.msvc.rt.x86 (= 19.28.29336)
enter code here.Engu.runtime.windows.msvc.rt.x64 (= 19.28.29336)
I checked and c:\windows\Microsoft.NET\Framework contains a folder for v2.0.50727, so it seem .net 2.0 is installed (as is v3.0, v3.5, v4.0.30319)
I have emgu.CV 4.5.1.4349 installed.
I need this library so that I can have the enter code herebitmap.ToImage<Bgr, byte>(); function.
Why am I getting this error?
Any help would be greatly appreciated.
The solution is migrating from package.config to package references for every project you have. Simply right click on package.config and click "migrate package.config to PackageReference".
Then, install the runtime package again and it will work.
For the new Emgu Nuget package you do need to use PackageReference instead of the traditional package.config.
What worked for me on Visual Studio 2017:
Uninstall all NuGet Packages [This removes the package.config file]
Go to Tools --> Options --> NuGet Package Manager --> General
Change the default package management format to "PackageReference"
Check "allow format selection on first package install"
Click OK
Install Emgu.CV, Emgu.CV.Bitmap, Emgu.CV.UI and Emgu.CV.runtime.windows
These Emgu packages should now appear under your references and you should not see a package.config file.
Nuget Options Image
I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.
Visit the nuget page for the package.
Click "Download Package" to download the nuget package directly.
Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
Copy both dll files into the output directory of your project.
After doing this, my code executed without error. Make sure to install emgu.CV.Bitmap as well.
I changed my projects Target Framework to ".NET Framework 4.6" and then went to "Manage NuGet Packages", selected "Browse", typed in "emgu.cv.runtime" then installed version 4.5.1.4349 and it worked.
Here is how I solved it,
1- downgrade .Net framework to 4.6 from project properties
2- Uninstall Emgu.CV and related ones (you will see which ones needed to be uninstalled in Errors List)
3- Install Emgu.CV.runtime.windows from Solution Nuget Manager ( it should install fine now)
3- upgrade .Net framework to 4.8
4- install Emgu.CV 4.5.1 (latest)
5- install Emgu.CV.UI 4.5.1 (Emgu.CV.Bitmwp was installed automatically for me)
and that's it, now you can use bitmap.ToImage<Bgr,Byte>(), note that the Image<Bgr,byte>(bitmap) doesn't work anymore.

Creating Xamarin.Forms .Net Standard app with Azure IOT Library?

I'm making an iOS/Android app that will work with Azure IoT Hub. The latest Microsoft.Azure.Devices version from what I understand is only compatible with .Net Standard projects. I've been trying to follow these twho tutorials (1, 2) to convert PCL project to .Net Standard project to no avail, and I'm lost on what I'm doing wrong.
These are the steps that I'm taking.
Create new Cross Platform App called TestProject. Xamarin.Forms -> Blank App -> Portable Class Library (PCL)
Right click solution -> Add New Project -> .Net Standard -> Create .Net Standard Library called TestProject.Core
Delete the auto generated class Class1.cs and move App.xaml and MainPage.xaml to TestProject.Core.
Delete Portable Library TestProject.
Rename TestProject.Core to TestProject.
Add TestProject reference to iOS and Android.
Click on TestProject and select Edit TestProject.csproj. Change PropertyGroup to following:
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8
</PropertyGroup>
Right click on solution and select Manage Nuget Packages For Solution.
Check Include Prerelease and install 2.3.5.256-pre6 Xamarin.Forms on TestProject, TestProject.Droid and TestProject.iOS.
Clean and Rebuild solution.
Right click on TestProject and select Manage Nuget Packages. Install Microsft.Azure.Devices
Clean and Rebuild.
Add code to TestProject that uses Microsoft.Azure.Devices.
Rebuild and get error:
Project File Line Suppression State Error Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Microsoft.Azure.Devices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Perhaps it doesn't exist in the Mono for Android profile? File name: 'Microsoft.Azure.Devices.dll'
From what I can understand I am missing Microsoft.Azure.Devices Nuget package on
TestProject.Droid, however, when I attempt to install it, I get the following error:
Could not install package 'System.Threading.Overlapped 4.3.0'.
You are trying to install this package into a project that targets
'MonoAndroid,Version=v7.1', but the package does not contain any assembly references or
content files that are compatible with that framework.
When I try to install *Microsoft.Azure.Devices** on iOS:
Could not install package 'System.Threading.Overlapped 4.3.0'. 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.
I'm making an iOS/Android app that will work with Azure IoT Hub. The latest Microsoft.Azure.Devices version from what I understand is only compatible with .Net Standard projects.
Per my understanding, you could leverage the Azure IoT Hub client SDK portable library Microsoft.Azure.Devices.Client.PCL which supports Android, iOS, Windows 10 (UWP) and Windows Phone (WinRT). Also, here is a sample uses Microsoft.Azure.Devices.Client.PCL, you could follow here.

Nuget client 3.0 support

I am writing xamarin app which will work on windows and OS X (using profile 7)
I am trying to add the nuget system.xml.xpath
However, it gives me the below error-
Adding System.Xml.XPath...
The 'System.Xml.XPath 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.7.0'.
I have two question-
1.
how soon will xamarin start supporting nugget client 3.0 or above?
2.
how can i resolve my specific problem?
On OS-X you can:
sudo nuget update -self
Note: sudo is required as this will update the nuget.exe within the Mono Framework
>nuget
NuGet Version: 3.4.4.1321
There is a nuget3 branch of Xamarin Studio 6.1 but I have not seen when that will go into an public alpha release...
You do not say what development environment you are using. The error message suggest you are using Xamarin Studio, since Visual Studio already supports NuGet 3.
There is a preview branch of Xamarin Studio 6.1 which does support NuGet 3, this is currently available on the alpha channel in Xamarin Studio.
However whilst using Xamarin Studio 6.1 will allow you to do is add the System.Xml.XPath NuGet package to your project you will still not be able to use anything from that NuGet package currently since there are no assemblies in it for the Xamarin frameworks and currently the Xamarin build tools will not add the correct assembly references for you at compile time.

Xamarin in Visual Studio cannot add xamarin.forms from Nuget

I downloaded the xamarin.form project from github. But when I build the project it is missing the xamarin.forms package.
I tried adding it with Nuget but got this error:
Installing 'Xamarin.Forms 1.3.3.6323'.
Successfully installed 'Xamarin.Forms 1.3.3.6323'.
Adding 'Xamarin.Forms 1.3.3.6323' to DialogPro.
Uninstalling 'Xamarin.Forms 1.3.3.6323'.
Successfully uninstalled 'Xamarin.Forms 1.3.3.6323'.
Install failed. Rolling back...
Could not install package 'Xamarin.Forms 1.3.3.6323'. You are trying to install this package into a project that targets 'portable- net45+sl50+MonoAndroid10+xamarinios10+MonoTouch10', 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 can it fix it? Please help me! Thanks.
It looks like you are targeting the wrong profile. You don't have windows phone but you do have silverlight. Do you need silverlight? I know that it definitely works with Profile 78 or 259. Adjust your targets and then try to add the nuget package again. Unfortunately, this means you probably should re-add all of your nugets for that package since the target changed.
edit:
Here's a good article on some of the xamarin supported profiles: http://danrigby.com/2014/04/16/xamarin-pcl-profile-notes/. I forgot that silver light is included. If you open the project in Xamarin Studio, it actually tells you the profile number. Open the csproj in a text editor and see if the profile number is listed at the top.
It sounds like you are adding Xamarin.Forms to a project that doesn't target any of the required frameworks.
You only need to add Xamarin forms package to your android, iOS, WinPhone and PCL projects.

Monogames can't add SharpDx Dll

Yo,
I have follow this tuto step by step : http://developer.nokia.com/Community/Wiki/XNA_Games_On_Windows_Phone_8_with_Monogame
But still not working.
errors message : Warning 8 The referenced component 'SharpDX' could not be found. MonoGame.Framework.WindowsPhone
or
Warning 4 The referenced component 'SharpDX.WP8' could not be found. MonoGame.Framework.WindowsPhone
i have deduce SharpDx was missing (obvious), but when i try to add the reference using Nuggetsmanagepacket; I have the following message :
Installing 'SharpDX 2.5.0'.
Successfully installed 'SharpDX 2.5.0'.
Adding 'SharpDX 2.5.0' to MonoGame.Framework.WindowsPhone.
Uninstalling 'SharpDX 2.5.0'.
Successfully uninstalled 'SharpDX 2.5.0'.
Install failed. Rolling back...
Could not install package 'SharpDX 2.5.0'. You are trying to install this package into a project that targets 'WindowsPhone,Version=v8.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.
Any Idea about what the problem, no awnser on Wiki_nokia website.
I have WP8 Sdk, and i'm using full version of Visual studio express 2012 (on Windows 8 )
Unfortunately nuget packages don't support platform specific builds of SharpDX. You need to add all references manually.

Categories

Resources