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?
Related
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" />
We have a solution with two projects (both version .net 4.6.2).
When installing a nuget package from our private Nuget Feed to either one of the projects, it works.
If we try to install the same package version into both projects, then package gets installed into one of them, and the other one gives error : "Error Could not install package 'OurInternalPackageName 1.0.1.5'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.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. ".
We tried installing nuget using 'Manage packages for solution' option, manage nuget packages for projects separately but the result is still the same.
Changing .NET framework versions does not help.
Clearing Nuget cache did not help as well.
The workaround we are using now: install package to one of the projects, and then install a lower version of a package to another project.
We tested this with 'Automapper' Nuget, tried to install into both projects and it worked (Same version got installed into both projects).
Any ideas would be appreciated.
I am working on a Visual Studio solution with two projects which I will call Red.dll and Blue.dll for the purpose of this question. Note that Red.dll depends on Blue.dll. These are both compiled in .NET Standard 2.0 with the output type of "Class Library".
I added the dll of each project to a common NuGet package called "Red" using NuGet Package Explorer. It has the following structure:
lib
- netstandard2.0
- Red.dll
- Red.xml
- Blue.dll
- Blue.xml
Here is the problem: When I attempt to install this NuGet package to a .NET Core application, I receive the following error:
Error NU1101: Unable to find package Blue.dll. No packages exist with this id in source(s): Desktop, Microsoft Visual Studio Offline Packages, nuget.org
Blue.dll is not a NuGet package. I don't know why it thinks it is.
Blue.dll is located directly beside Red.dll.
There are no external dependencies other than Newtonsoft.Json which is irrelevant.
And to reiterate, Blue.dll is NOT a NuGet package dependency. I realize if you use the "Pack" feature in Visual Studio it will create a dependency, but I created this NuGet package manually to avoid that.
But most importantly: This all works perfectly in .NET Framework! The NuGet package successfully installed, both dlls are referenced, the code builds without any errors, and the XML documentation is accessible.
Why does this work in .NET Framework but not .Net Core?
I haven't found anything else online about this particular problem.
I tried a lot, but I can't install Microsoft.ProjectOxford.Face NuGet into Xamarin Studio iOS project.
I got this error:
Could not install package 'Microsoft.ProjectOxford.Face 1.2.5.1'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.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 tried to update all packages, also Xamarin and still same problem. Only this package does not work - other like Newtonsoft.Json, Mircosoft.Net.HTTP and many other was installed correctly. I tried to install first Microsoft.BCL also Microsoft.BCL.Build and it also does not work.
Maybe you have any thoughts what can I do to make it work?
Unfortunately this is a problem with the Microsoft.ProjectOxford.Face 1.2.5.1 NuGet package itself. Whilst it has a portable class library (PCL) folder this does not map to a valid PCL profile:
portable-net45+wp80+win8+wpa81+aspnetcore50
If the aspnetcore50 part of that folder is removed then it would install into Xamarin.iOS. As it is, NuGet will not allow you to install it.
The only thing left you can do is unzip the NuGet package and try directly using the assembly. NuGet will not allow you to install it.
I believe there are plans to update the NuGet package to fix this, but that has not yet happened.
I'm trying to install a nuget package that depends on Newtonsoft.Json version 8.0.2. However, my project references a version 4.5.0 and I get a File Not Found exception when I run my tests. Can I get this to work without upgrading my project reference?