After adding the Package PureSocketCluster version 3.1.0 to my Xamarin project, I get the following error when compiling:
.../Projects/HelloWorld/HelloWorld.iOS/CSC: Error CS1703:
Multiple assemblies with equivalent identity have been imported: '.../.nuget/packages/system.reflection.emit/4.3.0/ref/netstandard1.1/System.Reflection.Emit.dll'
and
'/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Reflection.Emit.dll'.
Remove one of the duplicate references. (CS1703) (HelloWorld.iOS)
During the installation, I observed the following warnings:
Detected package downgrade: Xamarin.Forms from 3.4.0.1008975 to 3.1.0.697729. Reference the package directly from the project to select a different version.
HelloWorld.iOS (>= 1.0.0) -> HelloWorld (>= 1.0.0) -> Xamarin.Forms (>= 3.4.0.1008975)
HelloWorld.iOS (>= 1.0.0) -> Xamarin.Forms (>= 3.1.0.697729)
It's a very basic Hello World project, I just wanted to check if the communication with my socketcluster based websocket works in general.
I am using Visual Studio 2017 for Mac 7.6.11.
I'm fairly new to VS, so please don't kill me, if I made a stupid beginner mistake.
The way to resolve the issue is to add this to the iOS project file.
<PackageReference Include="System.Reflection.Emit">
<Version>4.3.0</Version>
<ExcludeAssets>all</ExcludeAssets>
</PackageReference>
Of course you need to make sure the nuget package has been added to the iOS package first.
Here is a similar issue that you can refer.
Related
I use the MonoGame 3.8.1.303 template to create my Android project, not the MAUI template. And I set UseMauiEssentials to true in my Android csproj file so that I can use Microsoft.Maui.Essentials.
The problem is that I cannot install the NuGet package Xamarin.Forms 5.0.0.2545 in my Android project because I get this error:
Version conflict detected for Xamarin.Google.Android.Material.
Install/reference Xamarin.Google.Android.Material 1.6.0 directly to
project AndroidProject to resolve this issue. AndroidProject ->
Microsoft.Maui.Dependencies 6.0.548 -> Xamarin.Google.Android.Material
(>= 1.6.0) AndroidProject -> Xamarin.Forms 5.0.0.2545 ->
Xamarin.Google.Android.Material (>= 1.4.0.2 && < 1.5.0).
I'm nor sure if I can use Xamarin.Forms with Microsoft.Maui.Essentials together in my MonoGame Android project.
Should I install Xamarin.Google.Android.Material 1.6.0 without Xamarin.Forms or what does the error message mean?
I use Target Android version 13.0 (API level 33).
EDIT: I have installed Xamarin.Google.Android.Material and after that I have tried to install Xamarin.Forms but then I get a version conflict with another Xamarin package.
I'm nor sure if I can use Xamarin.Forms with Microsoft.Maui.Essentials
together in my MonoGame Android project.
We know that Xamarin.Forms is a nuget for xamarin forms, and Microsoft.Maui.Essentials is a part a maui. So, you cannot install them to the same app.
You should figure out whether your current app is a Xamarin Forms project or a MAUI. Then select the corresponding package according to your needs.
In my project I have a package A using System.Runtime.CompilerServices.Unsafe v>=5.0.0, and another package B using System.Runtime.CompilerServices.Unsafe v=4.5.3.
When I try to install System.Runtime.CompilerServices.Unsafe v=4.5.3 from the NuGet Package Manager I get the following error:
Detected package downgrade: System.Runtime.CompilerServices.Unsafe from 5.0.0 to 4.5.3. Reference the package directly from the project to select a different version.
I found information related to this issue at https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605, where it is suggested to add a PackageReference of the needed version.
I tried to add reference for the 4.5.3 version or for both versions, yet nonE of these solutions seem to work.
Am I doing something wrong? How is it possible to use two different versions of the same package in one project?
I need help for Xamarin Form. I have a Xamarin Application has developed in Visual Studio 2017 (Version 15.9.13). I am facing the compiling error as below. I have updated my code with the latest version from Git updated by other team member. After that I am not able to compile.
error XA2002: Can not resolve reference: System.Threading.Tasks.Extensions, referenced by System.Reactive. Please add a NuGet package or assembly reference for System.Threading.Tasks.Extensions, or remove the reference to System.Reactive.
I have tried to install the below library by NuGet but the same error.
System.Threading.Tasks.Extensions (4.6.0-preview.18571.3)
System.Reactive.Linq (4.2.0-preview.566)
System.Reactive (4.2.0-preview.566)
I have already updated my VS2017 with latest version.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1898,2): error XA2002: Can not resolve reference: System.Threading.Tasks.Extensions, referenced by System.Reactive. Please add a NuGet package or assembly reference for System.Threading.Tasks.Extensions, or remove the reference to System.Reactive.
Try one of these:
Downgrading System.Threading.Tasks.Extension from 4.5.1 to 4.4.0 and using it with:
System.Reactive 4.1.0 (latest)
System.Reactive.Interfaces 4.1.0 (latest)
System.Reactive.Linq 4.1.0( latest)
System.Reactive.PlatformServices (latest)
System.Threading 4.3.0 (latest)
System.Threading.Taks 4.3.0 (latest)
System.Threading.Tasks.Extensions 4.4.0 (downgraded)
Keep System.Threading.Tasks.Extensions upgraded, installing System.Runtime.CompilerServices.Unsafe to all Android, iOS, and UWP projects, and downgrading System.Reactive to version 4.0.0
But also, consider switching to VS 2019, all release versions of VS 2019 (including for Mac) should come with a fixed version of Xamarin.Android now.
Installing any package fails with this error, updating packages also creates this error. Clearing the NuGet cache files causes this error to change to "access to the path mono.cecil.dll is denied" when trying to install "Xamarin.GooglePlayServices.Ads". Restarting visual studio causes the package restore error to come back.
Versions:
OS: win 10
Visual Studio Information:https://pastebin.com/vnuyZMWk
Xamarin.Forms Project:
Target framework: .NET 2.0
Xamarin.Android project:
Minimum Android Version: 5.0 (API Level 21)
Target Android Version: Use Compile Using SDK version (8.0)
Well after some trial and error I have the solution.
Visual Studio:
Update visual studio https://pastebin.com/GkEeRqg3
Updates Xamarin.Forms and NuGet
Repair visual studio from the "Visual Studio installer"
This Fixes the access denied to *.dll error
Xamarin.Android project:
Set Target Android Version: 8.1 API 27
This makes the packages the require monoandroid81 happy.
Cleaning house
Delete the folder C:\Users\<Your_Name>\AppData\Local\Xamarin`
Not sure if this was necessary but I am documenting anything I did so others can replicate the solution.
Fixing NuGet
Right-click <Project_name>.android --> Set as startup project.
Tools --> NuGet Package Manager --> Package Manager Console
In the console CLI run Update-Package -Reinstall
Why did this happen?
One way or another some of the NuGet packages used in Xamarin.Android used monoandroid81. Even though my solution was set to use 80 some NuGet packages installed were only compatible with 81. This was shown in the NuGet Console.
Package Xamarin.Android.Support.v7.MediaRouter 27.0.2 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.MediaRouter 27.0.2 supports:
monoandroid81 (MonoAndroid,Version=v8.1)
I faced the same error when I was trying to update the libraries one by one. Then I tried selecting all required libraries and clicked the Update button bellow the search box and it works. I have to tell that these libraries had dependencies between each other.
Here's an example:
I am trying to Build a web Project that uses ASP.NET CORE Framework.
In the start.cs file I'm getting compile time error near app.UseBrowserLink() and I don't know why. I didn't make any changes on that file.
"Error CS0121 The call is ambiguous between the following methods
or properties:
'Microsoft.AspNetCore.Builder.BrowserLinkExtensions.UseBrowserLink(Microsoft.AspNetCore.Builder.IApplicationBuilder)'
and
Microsoft.AspNetCore.Builder.BrowserLinkLoaderExtensions.UseBrowserLink(Microsoft.AspNetCore.Builder.IApplicationBuilder)' MyPage C:\Users\adduria\Source\Repos\TelerikUI\MyPage\src\MyPage\Startup.cs 49 Active"
Can you please help me with that?
Check your Nuget, you might have both the
Microsoft.VisualStudio.Web.BrowserLink and Microsoft.VisualStudio.Web.BrowerLink.Loader packages referenced. Remove the Loader one.
I got the same error on visual Studio 2017. To solve this problem:
Install Microsoft.VisualStudio.Web.BrowserLink 2.2.0
Rebuild your project
Same error for me on Visual Studio 2017, v15.9.10, using .NET Core 2.1. I solved it by installing the following NuGet packages, in order:
Microsoft.AspNetCore.Hosting.Abstractions v2.1.1
Microsoft.VisualStudio.Web.BrowserLink v2.1.1
The package version you need will depend on the project's .NET Core version. As far as I can tell, you have to guess. Give it your best shot, and if the install fails the error message will sometimes tell you which version to install, or that you've picked a version that's too low. Use the clues in the error messages to zero in on the correct version.
You need to install the following dependencies:
Microsoft.VisualStudio.Web.BrowserLink
Microsoft.Extensions.FileProviders.Physical
Microsoft.Extensions.FileSystemGlobbing
Microsoft.AspNetCore.Hosting.Abstractions
Microsoft.Extensions.Hosting.Abstractions
Microsoft.AspNetCore.Hosting.Server.Abstractions
Microsoft.Extensions.Configuration.Abstractions
Microsoft.AspNetCore.DataProtection.Abstractions
Microsoft.AspNetCore.Cryptography.Internal
Microsoft.Extensions.WebEncoders
Microsoft.AspNetCore.Authentication.Core
Microsoft.AspNetCore.Http.Extensions
Microsoft.Extensions.FileProviders.Abstractions
Microsoft.AspNetCore.Http
Microsoft.Extensions.ObjectPool
Microsoft.AspNetCore.WebUtilities
Microsoft.Net.Http.Headers
Microsoft.AspNetCore.Authentication.Abstractions
Microsoft.Extensions.Options
Microsoft.Extensions.Logging.Abstractions
Microsoft.Extensions.DependencyInjection.Abstractions
System.ComponentModel.Annotations
Microsoft.Extensions.Primitives
Microsoft.AspNetCore.Http.Abstractions
Microsoft.AspNetCore.Http.Features
Microsoft.Extensions.Primitives