Error XA2002: Can not resolve reference: `Microsoft.Bcl.AsyncInterfaces` - c#

I want to run my app in xamarin.forms but I faced this problem
Error XA2002: Can not resolve reference: Microsoft.Bcl.AsyncInterfaces, referenced by SimpleInjector. Please add a NuGet package or assembly reference for Microsoft.Bcl.AsyncInterfaces, or remove the reference to SimpleInjector. 0
I'm using Couchbise.Lite packages as Database for my app
I'm using VS2022

I installed the package Couchbase.Lite on my side(with VS 2022) and figured out that the error only happened on Version 3.0.0.Using Version 2.8.6 or below is functioning well.

Related

VS error message while scaffolding identity

Can someone help me understand this Visual Studio error message and suggest a fix?
I am getting the error message while scaffolding Identity.
This is the error message I get:
There was an error running the selected code generator: 'Error: An
assembly specified in the applciation dependencies manifest
(Intacct.deps.json) has already been found but with a different file
extension: package:
'Microsoft.VisualStudio.Web.CodeGeneration.Design', version: '3.1.0'
path: 'lib/net461/dotnet-aspnet-codegenerator-design.exe' previously
found assembly:
'C:\MyPath\Users\MyUser.nuget\packages\microsoft.visualstudio.web.codegeneration.design\3.1.0\lib\netcoreapp3.1\dotnet-aspnet-codegenerator-design.dll
The issue was occurred due to the NuGet manager already has a reference for Microsoft.VisualStudio.Web.CodeGeneration.Design. in the C:\Users\Lenovo\.nuget\packages\microsoft.visualstudio.web.codegeneration.design\3.1.1\ folder in C drive.
As well as the reference was also available in the Project package
Follow the below steps to resolve the error,
Goto your project and Expand Dependencies tab
Expand packages and search for Microsoft.visualstudio.web.codegeneration.design(3.1.1) package
Right-click on the package name and Remove the package.
Build the project and try.
Only reinstall package.
open Tools-> NuGet package Manager-> Package Manager Console
Update-Package -reinstall

Assembly from nuget has strong name but cause build error of 'strongly-named assembly is required'

I successfully installed 'LiveCharts.Wpf' & 'LiveCharts' packages from NuGet, I use them in my code but when I want to build the project I get this error:
Unknown build error, 'A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Note that those packages have a strong name. You can see it in the attached image:
Thanks.
I had similar issue, after publishing and trying to build a newer version with VS2017. I switched, in the properties->publish -> application files, for the nuget settings to include. From:
To:
I still don't know what caused this problem, but I opened a new project and installed the packages with 'package manager console' and not from 'NuGet Package Manager' and it's work.

Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0' exception when starting Stateful Service

I have created a new Service Fabric application in Visual Studio 2017 (version 15.7.1) and added a new service using the .Net Core 2.0 Stateful Service template.
When I try to run the service it fails to start correctly and I can see the following exception in the Diagnostic Events:
Description='Replica had multiple failures during open on _Node_0.
API call: IStatefulServiceReplica.ChangeRole(P);
Error =
System.IO.FileNotFoundException (-2147024894)
Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
The system cannot find the file specified.
I fixed this by installing the Nuget package System.ServiceModel.Primitives:
PM> Install-Package System.ServiceModel.Primitives
An answer which may be useful after a Windows 11 update.
In my case, after an update of Windows 11, the application wasn't working because of this error. I had the error Could not load file or assembly System.ServiceModel, version 3.0.0.0.
After long research, I uninstalled the .net framework and re-installed it and it worked.
For this, I used the programs/Uninstall a program/Add remove windows features.
Unchecked all .net framework cases and click on the Okay button.
After the uninstall process, I checked the same cases and click on the Okay button.
Bingo!
The System.ServiceModel.Primitives has what I think is a rather odd bug. If you are using a DLL with a System.ServiceModel.Primatives dependency, then you must also install it as a reference in the project that is using that DLL. If you do not the DLL will not know where to find it and you get the dreaded "could not load file or assembly..."
As Ragtimewilly indicated you can easily add the reference through Nuget.
There may be a better way to do this - but adding it through Nuget will do the trick.

References Assembly EntityFramework

I'm working on one of those new "Class Library (NuGet Package)" projects in Visual Studio. Everything was going fine until the other day it started raising an error about a:'assembly 'EntityFramework.Core, Version=7.0.0.0 reference??
How can I install the 7.0 version of EntityFramework into my Nuget packages??
"This issue" says that you need to add a reference to:
assembly 'EntityFramework.Core, Version=7.0.0.0
You can solve it by running the following command in the Package Manager Console:
Install-Package EntityFramework.Core -Pre
The issue is the EF version is different and following 2 assemblies are not supported.
using System.Data.Objects;
using System.Data.Objects.DataClasses;
Comment the above 2 lines and the following line in the code behind of your .edmx
using System.Data.Entity.Core.Objects;

Ninject.Web.Mvc.FluentValidation and FluentValidation.MVC4

I have tried setting up Ninject.Web.Mvc.FluentValidation in my ASP.NET MVC4 project
as shown below:
var ninjectValidatorFactory = new NinjectValidatorFactory(kernel);
//ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new NinjectValidatorFactory(kernel)));
FluentValidationModelValidatorProvider.Configure(x => x.ValidatorFactory = ninjectValidatorFactory);
DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
but I am getting the below errors:
Error 1 The type 'FluentValidation.ValidatorFactoryBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'FluentValidation, Version=2.0.0.0, ...
Error 2 Cannot implicitly convert type 'Ninject.Web.Mvc.FluentValidation.NinjectValidatorFactory' to 'FluentValidation.IValidatorFactory'. An explicit conversion exists (are you missing a cast?)
I can see the NuGet Package for Ninject.Web.Mvc.FluentValidation is version 3.0.0.0
and the error is telling me it is looking for version 2 of FluentValidation for its dependency.
If I install the NuGet package just for Ninject.Web.Mvc.FluentValidation then it installs the FluentValidation v2 dependency rather than version 3.4.6
but I can also see here: https://github.com/ninject/ninject.web.mvc.fluentvalidation/commit/82096d0afd15c41d01c09fd47f4247682261768e
a note about the project being updated for version 3.4.6
I am currently using NuGet to add the FluentValidation.MVC4 package to my project and then adding Ninject.Web.Mvc.FluentValidation after it (which finds it's dependency already exists and doesn't add it).
I can see that the NuGet package was last published on the 1st April 2013 but when I look at the .nuspec file in my project it shows
<dependency id="FluentValidation" version="3.2.0.0" />
Is there anything I have done wrong with this setup? or a way I can get this working through the package manager console to update the dependency version?
UPDATE: The reason for this is because Ninject.Web.Mvc.FluentValidation is using the signed version of FluentValidation which is strongly named.
David Ebbo has a good post about strong names and binding redirects here
http://blog.davidebbo.com/2011/01/nuget-versioning-part-3-unification-via.html
I still did not bother doing this to fix my problem, the NuGet package only has 1 class, the NinjectValidatorFactory, so it's worth just implementing your own.
To fix my problem for now I have put the NinjectValidatorFactoryclass into my own project. This looks to me like the current NuGet package needs to be updated further before it uses FluentValidation 3.4.6.
enter these codes in Package Manager Console :
Install-Package FluentValidation-Signed
Install-Package FluentValidation.MVC3-Signed -IgnoreDependencies
Install-Package Ninject.Web.Mvc.FluentValidation -IgnoreDependencies
-IgnoreDependencies is important .

Categories

Resources