Could not install package - Package target the same as project's settings - c#

I'm working on an Android project in Xamarin for Visual Studio.
I'm getting an error whereby the Xamarin.Facebook.Android SDK targets the 5.1 framework, which is what my
Target Framework(Compile using), Target Android version and Minimum Android version are all set to(Have tried different variants of higher and lower).
The package in question has a dependency of Android V7, which I have installed.
Have an added an image for good measure.
This is a fresh project, and i've tried rebuilding the solution after any trial-and-error changes to the project's properties.
Screenshot: https://ibb.co/jOtfKk
Is this a bug, or has someone else encountered this scenario?

Created another project and it miraculously worked this time.
Man I hate the VS, C# and Xamarin world.

Related

Error CS1703 Multiple assemblies with equivalent identity have been imported while building the Enterprise Bot Framework project

I got the below error while building the Enterprise Bot Template Project in VS2017. Not sure what i 'm doing wrong here.
Severity Code Description Project File Line Suppression State
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\XXX.nuget\packages\microsoft.netcore.app\2.1.0\ref\netcoreapp2.1\System.Runtime.Serialization.Json.dll' and 'C:\Users\XXX.nuget\packages\system.runtime.serialization.json\4.3.0\ref\netstandard1.0\System.Runtime.Serialization.Json.dll'. Remove one of the duplicate references. SovereignBot C:\Users\XXX\Documents\Visual Studio 2017\Projects\SovereignBot\SovereignBot\CSC 1 Active
Any ideas how to fix?
I'm not able to replicate this issue with a fresh install of the Enterprise VSIX template. This leads me to believe the issue is either in your code or on your machine.
After researching, it appears there could be a couple of problems and solutions:
Your Local/Development and Build servers use different versions of Visual Studio
Update Visual Studio for both environments
If you're still experiencing issues, try installing the Microsoft.CodeDom.Providers.DotNetcompilerPlatform NuGet package.
NuGet or .NET Core is out of date
Update NuGet
Update the appropriate .NET Core SDK. Currently, Bot Framework is supported well on .NET Core 2.2. Keep in mind that if you have 2.2 installed, you may need to update to the latest sub-version (v2.2.104, as of now). Keep in mind you may also need to upgrade your NuGet packages within the project in order to be compatible to the .NET Core SDK.
Ensure your bot is using the correct .NET Core Target Framework by right-clicking the Project > Properties > Application:
Your Visual Studio version doesn't handle dependency version collisions on its own
Update your Visual Studio
You have a duplicate reference to the same package (but possibly different versions) in your .csproj file
This is more likely if you're using code brought in from another project.
Delete or comment out the duplicate by right-clicking on your Project in Visual Studio, and clicking Edit .csproj:
You have a package installed via both NuGet and locally
(I don't believe this is the issue for you, since both of your packages appear to be in the NuGet directory)
Go to the file path of one of the dependencies and delete it.

Microsoft.Toolkit.Uwp.UI.Controls giving warnings when updated project to Fall Creators Update - Visual Studio UWP

I needed to change the min version as I must implement SQL framework.
Unfortunately, after changing min version to Fall Creators Update I get multiple reference errors, all talking about dll's missing like this:
The referenced component '(...)Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\netstandard.library\2.0.2\build\netstandard2.0\ref\System.Drawing.dll' could not be found
I get 116 warnings in total. I can still build and launch app, however it makes me wonder whats wrong.
I am pretty much sure whats giving these warnings.
I recreated the app by creating new solution and project and moving all code from the previous version.
Everything went smooth until I installed this:
Microsoft.Toolkit.Uwp.UI.Controls
And the warnings appeared again.
The app works anyway, and the controls from the package I use work well too.
But whats wrong with the package? Is it not compatible with fall creators update?
Is there a mode to fix it? Or can I ignore it?
Microsoft.Toolkit.Uwp.UI.Controls giving warnings when updated project to Fall Creators Update - Visual Studio UWP
This issue should be an issue about the package Microsoft.Toolkit.Uwp.UI.Controls.
According to the error message:
The referenced component '(...)Program Files (x86)\Microsoft
SDKs\UWPNuGetPackages\netstandard.library\2.0.2\build\netstandard2.0\ref\System.Drawing.dll'
could not be found
It seems the UWP project missing the .net standard 2.0 references after installing the package Microsoft.Toolkit.Uwp.UI.Controls. So, to resolve this issue, we could add the .net standard library 2.0 package to the UWP project.
Besides, when I wanted to report this issue to the author of the package, I discovered that you have already done that. This is great. And I have found devsko provided the workaround, I post it here, so this can be beneficial to other community members reading this thread:
I just added Netstandard.Library package with NuGet Package Manager to my UWP library. That solved my problem
Certified: The referenced component could not be found - warnings in Fall Creators Update Min Target.

The $(TargetFrameworkVersion) for FormsViewGroup.dll (v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0) xamarin

the error is on visual studio 2017 and xamarin:
Severity Code Description Project File Line Suppression State
Warning The $(TargetFrameworkVersion) for FormsViewGroup.dll (v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0).
You need to increase the $(TargetFrameworkVersion) for your project.
IpiCommunicationXamarin.Android D:\XmarainTest\IpiCommunicationXamarin\IpiCommunicationXamarin\IpiCommunicationXamarin.Android\IpiCommunicationXamarin.Android.csproj
It means you have a reference (FormsViewGroup.dll) which uses the Android Framework Version of 7.1, but your project only targets 6.0.
You can update your Android Target Framework Version by going to your Android Project Properties (right click the Android Project and click Properties) and go to Application tab. If you can't find the 7.1 on the dropdown, you can install it using Android SDK Manager (I think 7.1 is API 25).
Hope this helps!
I feel it's kinda late for this answer but just had the same problem and this is the first post I found so I'll answer here what worked for me.
Inside Visual just go to Tools>Android>Android SDK Manager...
There just choose the latest version (or the one you are asked to use) and that should fix it.
There is something more subtle happening here . The issue is Xamarin.Forms version of Visual Studio version you are using . For example I was using Visual Studio 2019 it has Xamarin.Forms 4.2 . It requires that I compile with Android 8.1 or above . But I can deploy to Android version less than that by setting the minimum version of android and then deploying to it.
Project Properties >> Android Manifest >> Minimum Android Version dropdown
See here
Xamarin choosing TargetFramework and MinimumAndroidVersion
It is working for me this way:
Inside Visual Studio go to Tools>Android>Android SDK Manager... and ununstalled the latest Platform, setting it to be highest the Android 6.0 - Marshmallow
Android SDKs and Tools
Also at project properties set the Target Framework like below shown:
Target Framework
Try use menu button Build->Clean Solution. It helped me.

How can I update my xamarin android project with the latest NuGet packages support libraries?

I'm using vs 2013 and xamarin version 4.7, for about 2 months I have been trying to install packages Xamarin.Android.Support.v7.RecyclerView, Xamarin.Android.Support.v7.AppCompat
and Xamarin.Android.Support.v4 and some other packages but I always receive the same error that says :
"Could not install package 'package Name'. You are trying to install
this package into a project that targets 'mono.Android,Version=v5.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"
I've updated my xamarin android component to the last version, research this site, other site and test install packages by other android api version but my problem does not solve.
Can anybody help me?
Sahar,
If you are not compiling your application using Android version 7.0 (API Level 24 - Nougat), you can't install the latest support libraries 24.2.1 and above. The latest contains assemblies only compatible with MonoAndroid70, hence the error message.
As I see in the error message you are compiling using Android version 5.0 (API Level 22 - Lollipop), meaning the highest version of the support libraries you can install is 23.4.0.1. That version contains assemblies compatible with MonoAndroid403.
If you are not ready to move to Nougat, it's ok not to have the latest version of the support libraries.
If you're running Visual Studio 2017 on Windows, try these two steps:
Step One:
Make sure you're running the latest version of Visual Studio 2017 or higher. Then, go to QuickSearch (Control-Q) and look for "Xamarin Android". Select "Xamarin - Android Settings".
Scroll down and check the box for "Auto Install Android SDKs".
Step Two:
In your Android project, get Properties, then open the Application tab. Next to Compile using Android version: (Target Framework), select the latest SDK.
Then, under the Android Manifest tab, select Target Android version and select Use Compile using SDK version. You can still support earlier versions of Android - just select what you want, within reason, from the Minimum Android version dropdown. Be careful here - supporting super early versions of Android is likely fraught with peril.
Once you've taken care of these steps, you should be able to install the latest Android support libraries. I imagine there are similar steps to VS Mac, but I haven't checked.
Good luck!

Xamarin Studio cross platform app error

At the moment I'm trying to launch empty app with cross-platform solution in Xamarin Studio.
I've tried make app with empty library project and shared library, both has same errors. Now unresolved problems are:
1) Build error:
Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file classes.jar doesn't exist. (XA5207) (*projectName*)
Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file libs/internal_impl-21.0.3.jar doesn't exist. (XA5207) (*projectName*)
This question didn't help me.
2) Some links says it could be because of old Mono.Android.Support.v4 component. My component version is 21.0.3.0. After clicking for update it says:
You are trying to install this package into a project that targets 'MonoAndroid,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.
My Mono.Android assembly version is 0.0.0.0 and I dodn't know how to update it.
I've tried PCL project with PCL 4.5 - profile7. New projects builds normal, but after first project clean it gives me error about not found classes.jar file like described above. Another new PCL project still builds fine.
UPDATE
Error in PCL project occures not after clean - it occures with included Xamarin.Forms NuGet to Android project.
UPDATE
After rising target framework of android project to v4.0.3 I successfuly updated Mono.Android.Support.v4 component, but it still show me error about Please install package.
UPDATE
I'm using Windows 7 OS, same problem with all users including new user. But on another computer with Windows 8 it works. It is not a solution for me, but it can somehow help someone.
i think your java JDK and JRE not install properly and your path not set in your environment variable you must add your jdk path in that and if you are make application using cross platform then also add path SDK in your computer environmental variable. using CMD throw creating project.

Categories