Error while adding Xamarin plugin - c#

I'm using Xamarin Forms with Visual Studio 2015. I get this error while I'm trying to add a messaging plugin.
Severity Code Description Project File Line Suppression State
Error Unable to resolve dependencies. 'Xamarin.Android.Support.v4 23.0.1.3' is not compatible with 'Xamarin.Android.Support.Design 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)', 'Xamarin.Forms 2.2.0.45 constraint: Xamarin.Android.Support.v4 (= 23.3.0)'. 0
I have already updated Visual Studio and Xamarin, but still get this error.
What else should I do to fix this error?

This is a dependency issue. For Xamarin.Forms 2.2.0.45, the dependencies are
Xamarin.Android.Support.v4 (= 23.3.0)
Xamarin.Android.Support.Design (= 23.3.0)
Xamarin.Android.Support.v7.AppCompat (= 23.3.0)
Xamarin.Android.Support.v7.CardView (= 23.3.0)
Xamarin.Android.Support.v7.MediaRouter (= 23.3.0)
Note version conflict between the above and the error: 'Xamarin.Android.Support.v4 23.0.1.3' is not compatible with 'Xamarin.Android.Support.Design 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)'
You will need to install the compatible version of the messaging plugin you’d like to use. Here is a related troubleshooting guide: https://developer.xamarin.com/guides/xamarin-forms/troubleshooting/.

Related

NuGet problems after moving my Visual Studio extension from old csproj to SDK-style csproj

I've switched my Visual Studio extension from old csproj format to the new SDK-style format and hoped to get everything I need with the following package references (previously I had to reference like 100 different packages in my packages.config)
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="3.8.0" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" />
<PackageReference Include="NuGet.VisualStudio" Version="5.8.0" />
However, while the extension builds within Visual Studio, I run into problems when building the extension with MSBuild (when restoring NuGet packages):
"C:\Path\MyExt\MyExtension.sln" (Build target) (1) ->
"C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj" (default target) (9) ->
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.CoreUtility (>= 16.8.39) but Microsoft.VisualStudio.CoreUtility 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.CoreUtility 16.8.239 was resolved.
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.CoreUtility (>= 16.8.39) but Microsoft.VisualStudio.CoreUtility 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.CoreUtility 16.8.239 was resolved.
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.Text.Data (>= 16.8.39) but Microsoft.VisualStudio.Text.Data 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.Text.Data 16.8.239 was resolved.
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.Text.Data (>= 16.8.39) but Microsoft.VisualStudio.Text.Data 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.Text.Data 16.8.239 was resolved.
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.Text.Logic (>= 16.8.39) but Microsoft.VisualStudio.Text.Logic 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.Text.Logic 16.8.239 was resolved.
C:\Path\MyExt\MyExt.Tests\MyExt.Tests.csproj : error NU1603: Microsoft.CodeAnalysis.EditorFeatures.Text 3.8.0 depends on Microsoft.VisualStudio.Text.Logic (>= 16.8.39) but Microsoft.VisualStudio.Text.Logic 16.8.39 was not found. An approximate best match of Microsoft.VisualStudio.Text.Logic 16.8.239 was resolved.
Indeed, the packages are not on NuGet. Is this a problem with the Microsoft.VisualStudio.SDK package? Am I doing something wrong?
I think the issue is related the Microsoft.CodeAnalysis.EditorFeatures package itself. And you should contact with the author.
It's just that the problem is magnified by the new-sdk project and the true you set.
Actually, I faced the same issue in my side with even net core console project.
You can see this:
The nuget package has dependencies are >=16.8.39.
However, Microsoft.VisualStudio.CoreUtility does not have version 16.8.39 version but has 16.8.239. This is designed by the author. And according to the mechanism of nuget, it will install the minimum version of dependencies, but the new-sdk style project cannot automatically identify the invalid version, and this warning appears. But non-sdk style projects with packages.config will automatically install the valid version of the nuget dependencies.
So this issue is the dual influence of the design issue of the nuget package and the particularity of the new-sdk style project. It's just magnified in this case.
============================================
Workaround
To solve the issue, try these:
1) First, disable TreatWarningsAsErrors node under Project Properties-->Build
2) manually install
Microsoft.VisualStudio.CoreUtility 16.8.239
Microsoft.VisualStudio.Text.Data 16.8.239
Microsoft.VisualStudio.Text.Logic 16.8.239
nuget packages additionally to update the dependencies.
3) then enable TreatWarningsAsErrors to check.

How to build a native nuget package

I am trying to build the nuget package of the GDCM project. This project is written in C++ and offer a C# binding using SWIG.
Here is my current attempt:
This is based mostly on:
https://stackoverflow.com/a/52459363/136285
And references from:
https://learn.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks
https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
When I install this nuget package in a Visual Studio 2019 test project (.NET Framework 4, on Windows 8.1) here is the error message that I get:
--EntryPointNotFoundException
at gdcm.gdcmPINVOKE.new_ImageReader()
at gdcm.ImageReader..ctor()
at My.ReadSequenceVolume(Boolean doRead) in C:\Users\malat\test\ImageVolumeReader.cs:line 17
Result Message:
My.DicomBase.ImageReaderFileException : ImageReaderFileException exception : "Unable to find an entry point named 'CSharp_gdcm_new_ImageReader' in DLL 'gdcmsharpglue'." (type=System.EntryPointNotFoundException) while reading "RGB.dcm"
----> System.EntryPointNotFoundException : Unable to find an entry point named 'CSharp_gdcm_new_ImageReader' in DLL 'gdcmsharpglue'.
Is there an issue in the hierarchy I build for this native nuget package ?
Update: Per suggestion, I tried adding Microsoft.NETCore.Platforms:
<dependencies>
<dependency id="Microsoft.NETCore.Platforms" version="1.0.0" />
</dependencies>
Which gave me:
But now my test project reports:
Severity Code Description Project File Line Suppression State
Error Could not install package 'Microsoft.NETCore.Platforms 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.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.

UseSqlServer is missing and conflicting refrences?

Im trying to follow a Entity Framework Core video in a .NET Core 2.1 DAL class library. In the DbContext.OnCofiguring the following code is placed :
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseSqlServer("Server*.");
}
The problem is that the UseSQLServer is missing? From this its suggested to add Microsoft.EntityFrameworkCore.SqlServer nuget. When doing this I get some version conflicts that I dont know how to solve :
Severity Code Description Project File Line Suppression State
Error CS1061 'DbContextOptionsBuilder' does not contain a definition
for 'UseSqlServer' and no accessible extension method 'UseSqlServer'
accepting a first argument of type 'DbContextOptionsBuilder' could be
found (are you missing a using directive or an assembly
reference?) DataAccessLayer
--
Severity Code Description Project File Line Suppression State
Error Package restore failed. Rolling back package changes for
'DataAccessLayer'.
--
Severity Code Description Project File Line Suppression State
Error NU1605 Detected package downgrade:
Microsoft.Extensions.Configuration from 2.2.0 to 2.1.1. Reference the
package directly from the project to select a different version.
DataAccessLayer -> Microsoft.EntityFrameworkCore.SqlServer 2.2.3 ->
Microsoft.EntityFrameworkCore.Relational 2.2.3 ->
Microsoft.EntityFrameworkCore 2.2.3 -> Microsoft.Extensions.Logging
2.2.0 -> Microsoft.Extensions.Configuration.Binder 2.2.0 -> Microsoft.Extensions.Configuration (>= 2.2.0) DataAccessLayer ->
Microsoft.Extensions.Configuration (>= 2.1.1) DataAccessLayer
--
Severity Code Description Project File Line Suppression State
Error NU1605 Detected package downgrade:
Microsoft.Extensions.DependencyInjection from 2.2.0 to 2.1.1.
Reference the package directly from the project to select a different
version. DataAccessLayer -> Microsoft.EntityFrameworkCore.SqlServer
2.2.3 -> Microsoft.EntityFrameworkCore.Relational 2.2.3 -> Microsoft.EntityFrameworkCore 2.2.3 ->
Microsoft.Extensions.DependencyInjection (>= 2.2.0) DataAccessLayer
-> Microsoft.Extensions.DependencyInjection (>= 2.1.1) DataAccessLayer
--
I suspect that the project is using a couple of nuget packages and some of them is referencing a diffrent version of another nuget or dll.
It suggest to reference a package direcly? Does this mean that I should reference a dll manually? Where do I get the dll from?
The default severity for NU1605 is warning and since you're seeing it as an error, it means that your project has opt-in'ed into treating errors as warnings.
The reason for the package downgrade is probably due to NuGet's nearest-wins rule. The only way to avoid a downgrade is to add a PackageReference to the downgraded package to your project, that way the version you select is always nearest and transient dependencies can never downgrade it.
Otherwise you stop shooting yourself in the foot by either turning off "treat all warnings as errors" and list only the specific warnings you want treated as errors. Or, add NU1605 to the list of warnings to suppress (<NoWarn> in the csproj).

Xamarin.Firebase.Common not compatible with Xamarin.Firebase.Auth

I'm trying to install 'Xamarin.Firebase.Storage.42.1021.1' so I can upload photos to my firebase database
I'm targeting 'MonoAndroid, Version=v7.1'
However, when I try to install the package I get the following
Unable to find a version of 'Xamarin.Firebase.Common' that is compatible with 'Xamarin.Firebase.Auth 42.1024.0-beta1 constraint: Xamarin.Firebase.Common (= 42.1024.0-beta1)', 'Xamarin.Firebase.Storage 42.1021.1 constraint: Xamarin.Firebase.Common (= 42.1021.1)'.
Is there a quick fix without breaking my project?
You may checked the Dependencies of Xamarin.Firebase.Storage and Xamarin.Firebase.Auth.
According to your error message, you've installed the Xamarin.Firebase.Auth 42.1024.0-beta1 package, which needs dependency Xamarin.Firebase.Common (= 42.1024.0-beta1).
Try to downgrade your Xamarin.Firebase.Auth package to version 42.1021.1.

TFS Build - C# 7.0 System.ValueType

I try to setup a continuous integration build on VisualStudio.com to build my project. Since I upgraded to .net 4.6.2 and working with the System.ValueType, the build fails:
MinimalMonitoringClient\MMCThinNetwork\Connection.cs(91,23): Error
CS1519: Invalid token '(' in class, struct, or interface member
declaration Connection.cs(91,23): error CS1519: Invalid token '(' in
class, struct, or interface member declaration
[d:\a\1\s\MinimalMonitoringClient\MMCThinNetwork\MMCThinNetwork.csproj]
MinimalMonitoringClient\MMCThinNetwork\Connection.cs(91,47): Error
CS1044: Cannot use more than one type in a for, using, fixed, or
declaration statement Connection.cs(91,47): error CS1044: Cannot use
more than one type in a for, using, fixed, or declaration statement
[d:\a\1\s\MinimalMonitoringClient\MMCThinNetwork\MMCThinNetwork.csproj]
MinimalMonitoringClient\MMCThinNetwork\Connection.cs(91,64): Error
CS1002: ; expected
It compiles on my local computer
The NuGet Package "System.ValueType" is installed
No Package Folder on TFS
The Task "Restore NuGet Packages" is included in the build process
NuGet Restore Build Step finishes successfully
2017-04-22T14:42:13.2402898Z ##[section]Starting: NuGet restore
**/*.sln 2017-04-22T14:42:13.2512895Z ============================================================================== 2017-04-22T14:42:13.2512895Z Task : NuGet Installer
2017-04-22T14:42:13.2512895Z Description : Installs or restores
missing NuGet packages 2017-04-22T14:42:13.2512895Z Version :
0.2.31 2017-04-22T14:42:13.2512895Z Author : Microsoft Corporation 2017-04-22T14:42:13.2512895Z Help : More
Information
2017-04-22T14:42:13.2512895Z
============================================================================== 2017-04-22T14:42:14.3517087Z [command]C:\Windows\system32\chcp.com
65001 2017-04-22T14:42:14.3517087Z Active code page: 65001
2017-04-22T14:42:14.4246880Z Detected NuGet version 3.3.0.212 / 3.3.0
2017-04-22T14:42:14.4276880Z SYSTEMVSSCONNECTION exists true
2017-04-22T14:42:14.4286876Z To connect to NuGet feeds hosted in your
Team Services account/TFS project collection on this build agent, edit
your build definition to choose a higher version of nuget or specify a
path to a NuGet.config containing the package sources you wish to use.
2017-04-22T14:42:14.4316868Z
[command]d:\a_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe
restore -NonInteractive
d:\a\1\s\MinimalMonitoringClient\MinimalMonitoringClient.sln
2017-04-22T14:42:15.2210188Z MSBuild auto-detection: using msbuild
version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2017-04-22T14:42:15.4566895Z Feeds used: 2017-04-22T14:42:15.4566895Z
C:\Users\buildguest\AppData\Local\NuGet\Cache
2017-04-22T14:42:15.4576898Z https://api.nuget.org/v3/index.json
2017-04-22T14:42:15.4576898Z 2017-04-22T14:42:15.4786896Z Restoring
NuGet package System.ValueTuple.4.3.0. 2017-04-22T14:42:15.4896877Z
Restoring NuGet package Newtonsoft.Json.10.0.2.
2017-04-22T14:42:16.5110192Z Adding package 'System.ValueTuple.4.3.0'
to folder 'd:\a\1\s\MinimalMonitoringClient\packages'
2017-04-22T14:42:16.5330192Z Added package 'System.ValueTuple.4.3.0'
to folder 'd:\a\1\s\MinimalMonitoringClient\packages'
2017-04-22T14:42:16.7550436Z Adding package 'Newtonsoft.Json.10.0.2'
to folder 'd:\a\1\s\MinimalMonitoringClient\packages'
2017-04-22T14:42:16.7780484Z Added package 'Newtonsoft.Json.10.0.2' to
folder 'd:\a\1\s\MinimalMonitoringClient\packages'
2017-04-22T14:42:16.8080211Z ##[section]Finishing: NuGet restore
**/*.sln
In Build Solution the VS Version is set to: 2017
Clean: True
Restore NuGet Packages: True
Thanks in advance
You need to use the Hosted VS2017 Build Agent to compile things using VS2017.

Categories

Resources