I imported into my application's library System.Data.SqlClient which I can also see in my .csproj file, but as soon as I run my app, I get an exception thrown.
The two images show the details...
What am I doing wrong?
p.s. After downgrading System.Data.SqlClient to 4.6.1, I get a similar error, below. This keeps happening; after installing that, I get an error about 4.4.0 and so on...
Hi I think you have added nuget package in your library project(.dll). You need to add nuget reference in your main project where this library got referenced.
I think you need a lower version of System.Data.SqlClient because your project is .net core 2.
Please use the following package.
Uninstall-Package System.Data.SqlClient
Install-Package System.Data.SqlClient -Version 4.6.1
Related
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 have an Azure Function (version 3, dotnet 3.1) referencing the following nuget package:
Microsoft.Extensions.Configuration
When I try to install this nuget, I get the version 5.x of the package, which causes the installation of
Microsoft.Extensions.Configuration.Abstractions
But I have conflicts when running my function. The solution found on several other topics, is to downgrade the nuget package, as the Azure Function doesn't support 5.0 dependency for the Microsoft.Extensions.Configuration.Abstractions package.
So I execute the following command line in the package manager console to install the initial nuget package:
Install-Package Microsoft.Extensions.Configuration -Version 3.1.14 -DependencyVersion Lowest
But it always install the version 5.x of the dependency "Microsoft.Extensions.Configuration.Abstractions"
Any advice to download the right version of the dependency?
I used the command you gave, everything seems to be no problem:
1. As Sara Liu-MSFT mentioned in the comments, you may need to check whether other assemblies reference Microsoft.Extensions.Configuration.Abstractions. If so, you may need to downgrade that assembly.
You can check here:
2. Or you can try to manually reference the Microsoft.Extensions.Configuration.Abstractions assembly:
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.14" />
I am trying to write some unit tests in C# in a '.NETFramework,Version=v4.5.2' application but all tests give the next error:
'System.IO.FileNotFoundException : Could not load file or assembly
'System.Drawing.Common, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file
specified.'
When I try to install System.Drawing.Common I get the next error from the NuGet package:
Could not install package 'System.Drawing.Common 4.5.1'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.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.
I cannot change the application version or the framework (.NET Core 2.1) and any other trick I found online did not work (or generated more errors).
Help?
in NuGet put this line :
Install-Package System.Drawing.Common -Version 4.5.2
in .NET CLI put :
dotnet add package System.Drawing.Common --version 4.5.2
in Paket CLI put :
paket add System.Drawing.Common --version 4.5.2
Had the same problem. I have cloned solution https://github.com/barnhill/barcodelib . It has two projects: library project targets .Net Standard 2.0 and refers to System.Drawings.Common. Example project depends on library and has reference to System.Drawings.Common. Example project was not compiling due to same error.
My solution was just to remove reference to System.Drawings.Common in nuget packages and readd it (rclick on Example project > Manage nuget packages > Browse Installed, remove the System.Drawings.Common package, and then add it back), unload project and then reload it again
Helped for me.
I managed to solve it by restarting Visual Studio, changing the framework to 4.6.1 (which I could not do before) and adding the reference.
OP's solution migrated from the question to an answer.
you could try to use one of the libs described in here instead https://devblogs.microsoft.com/dotnet/net-core-image-processing/
you could try to use https://www.nuget.org/packages/CoreCompat.System.Drawing/ as well and maybe try to change your app framework to .net standard 2.0?
This is kind of bizarre but it worked dramatically so I'm going to mention it. I built a small vs 2017 ent console project that was supposed to read an oracle database. When I started to run it I got the System.Drawing.Common error mentioned above. It seemed stupid because I wasn't really doing anything having to do with Drawing at all. In Manage Nuget Packages I deleted the Oracle.ManagedDataAccess driver and added the Oracle.ManagedDataAccess.Core and the System.Drawing.Common error went away and I was able to read my oracle database. So I'm suggesting that with NuGet you may be picking up some things you really don't need and if you have any choice for your NuGet packages, try different ones. This also may be some foible with how my organization managed nuget for Visual Studio 2017 enterprise.
My ASP.NET MVC 5 EF 6 Application crashed because "System.Data.Entity.Core.UpdateException,EntityFramework, Version=6.0.0.0" was not found. I was wondering about the version 6.0 because I'm using the latest version 6.1.3.0 but I couldn't found any references to 6.0.0.0 which may cause this problem.
The solution to delete all temp ASP.NET files had no effect. Using NuGet, I downgraded the EntityFramework package from 6.1.3.0 to 6.0.0.0 and now everything works fine. But I want also to understand why this problem happened. My read is, that some other references are depending on EF in version 6.0.0.0 but I couldn't find out which ones.
I looked in the dependency-information of every installed NuGet package. The only one which refers to EntityFramework is MySQL.Data.Entity but not for the exact version 6.0.0.0, according to the info text he needs a version >= 6.0.0.0 so it should work fine with 6.1.3.0. Is there a way to let me see all assemblys depending on EntityFramework so that I can see which one depends on 6.0.0.0?
You may have two projects in your solution one using EF version 6.0.0 and the other project using 6.1.3.0.
If that is not the case consider updating all Nuget packages by right clicking on the project and Manage Nuget packages, then update all nuget packages.
Hope that helps.
First Manually install Entity-Framework-6.0 version on your project.
Open Console Package Manager in "Visual Studio" and execute this code
Install-Package EntityFramework -Version 6.0.0
And later Restart your solution and Right Click on Project select Manage Nuget Packages menu. Remove "Entity Framework 6.0.0" to all project and install Entity Framework last version on Nuget Packages Manager.
https://www.nuget.org/packages/EntityFramework/6.0.0
I am trying to add Unity.WebAPI to a .net 4.0 project. The latest version, 5.1.0 is for .Net 4.5 so I am trying to use version 0.10.0. I've tried using the Nuget Package Manager Console to install this version using the command:
Install-Package Unity.WebAPI -Version 0.10.0
It installs successfully but the reference in my project is notated with the caution symbol as if there is a problem. When I try to build I get the following error message:
The referenced component 'Unity.WebAPI' could not be found
Unity.WebApi is dependent on Unity which I have successfully installed version 2.1.505.0
One thing I have noticed is that when I go into my packages\Unity2.1.505.0\lib folder, I only have a NET35 and SL30 folder. I would think I would see a NET40 folder but that might be insignificant.
One other note is that I did try installing the later version of Unity.WebAPI version 5.1 which is dependent on Unity 3.0.1304.1 which is not compatible with .net 4.0.
I would welcome any ideas or suggestions on getting Unity.WebAPI installed on my .Net4.0 project. I'd also be glad to provide anymore information one might need to help.
Thanks in advance.