Unable to find a version of 'Newtonsoft.Json' - asp.net

My current asp.net mvc app needs 11.0.2 version of 'Newtonsoft.Json'
However, I want to add a nuget package "UmbracoCMS" that needs Newtonsoft.Json (>= 10.0.2 && < 11.0.0)'
Please let me know how I could handle this in the web.config
I tried assemblyredirect but that didn't help. Thank you.

Unable to find a version of 'Newtonsoft.Json'
This issue is not related to assembly-redirect, so you could not resolve it by web.config. That is because the prerequisite for assembly-redirect is that different versions of the Newtonsoft.Json assembly should be all acceptable for your project and we use assembly-redirect to select one of the version to our project.
Check a sample link.
However, your current question is that you can not get both versions to work for your project. Your asp.net mvc app needs 11.0.2 version of Newtonsoft.Json, but the nuget package UmbracoCMS that needs Newtonsoft.Json (>= 10.0.2 && < 11.0.0). You can not use both versions, so you can not use assembly-redirect to select one of the version to your project.
To resolve this issue, you have to resolve the reference conflict. Could you only use Newtonsoft.Json 11.0.2 for your asp.net mvc app? Can you use Newtonsoft.Json 10.0.2/10.0.3 instead? If yes, you can install Newtonsoft.Json 10.0.2/10.0.3, then you can install the nuget package UmbracoCMS. If not, I am afraid you could not install the nuget package UmbracoCMS.
Hope this helps.

Related

Which version of Microsoft.AspNet.Mvc is supported by .NETCoreApp v2.2?

I am working on a Ubuntu 18.04 environment using Visual Studio Code and .NET Core v2.2.
After including a few existing projects into a solution that I'm working on, I ran into errors when I tried to compile stating that the namespace "Microsoft.AspNet.Mvc" could not be found.
So, I added a package reference for the projects that were complaining by using the dotnet CLI:
dotnet add package Microsoft.AspNet.Mvc --version 3.0.20105.1
But now when I try to dotnet restore or dotnet msbuild the solution file, I'm getting warnings reporting that:
warning NU1701: Package 'Microsoft.AspNet.Mvc 3.0.20105.1' was
restored using '.NETFramework,Version=v4.6.1' instead of the project
target framework '.NETCoreApp,Version=v2.2'.
This package may not be fully compatible with your project.
I would like to figure out which package version of Microsoft.AspNet.Mvc I need to install in order to be compatible with .NET Core v2.2.
I realize that this is just a warning and using the .NETFramework v4.6.1 may be okay, but I have been debugging a very strange issue that is only happening on a Ubuntu environment, so I would like to determine whether package versioning is a problem.
I have tried Google searching to determine which version of MVC is compatible with .NET Core 2.2, but I have yielded any useful results.
Does anyone know the answer to this question? Or would you be able to point me in the direction of a source that can answer it?

Could not install package 'Splat 2.0.0'

Trying to install Splat 2.0.0 into Xamarin Forms project results with error:
Could not install package 'Splat 2.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', 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.
How to resolve this issue please?
Thanks,
AG
I found this on the GitHub of your tool:
Please use Splat 1.6.2 when targeting PCL projects. v2.0 and onwards is netstandard only. There will be no updates to the 1.6.x series so if you need to patch the release then please fork and maintain your own copy/build from source.
It seems they stopped supporting PCL. So as a solution I suggest using Splat 1.6.2 as that seems to support ¨PCL. Good luck

issues for NuGet after migrating a c# project

i'm trying to migrate a project into my visual studio 2012.
On the Manage NuGet Packages, I have this issue:
"Some NuGet Packages are missing from this solution. Click to restore from your online package sources"... but when i click on the restore button, it appears this issue:
"an error occurred while trying to restore packages: Unable to find version '4.1.0-alpha-121112' of package 'Microsoft.AspNet.WebApi'. "
i'm using .NET Framework 4
How can i solve?
Thanks in advance....
The problem is that version '4.1.0-alpha-121112' of package Microsoft.AspNet.WebApi does not exist on NuGet.org. It is not available on MyGet from the ASP.NET Web Stack Nightly package source either. So NuGet cannot restore it since it is no longer available.
Looking at Symbol Source it looks like this NuGet package was at one point available from the ASP.NET Web Stack Nightly package source on MyGet but it no longer seems to be available. I suspect they have deleted the old packages from that MyGet package source.
Unless you can find the original NuGet package, you will either have to manually remove the NuGet package reference, by editing the project file and packages.config file, and reinstall a version that exists.
1) Make sure you upgrade to the latest NuGet.
2) Make sure you're doing package restore "The Right Way" http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
That should resolve the issue.
if still this ain't solve you can see this Rightway to migrate

NuGet: 'X' already has a dependency defined for 'Y'

I'm getting the following error in NuGet while trying to install package Microsoft.AspNet.Server.IIS
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS.Interop (≥ 1.0.0-alpha4-10330)'.
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS (≥ 1.0.0-alpha4-10330)'.
'Microsoft.AspNet.Loader.IIS' already has a dependency defined for 'Microsoft.AspNet.FeatureModel'.
How to resolve it?
UPDATE:
Also, I'm getting the following:
Attempting to resolve dependency 'Microsoft.Framework.DependencyInjection (≥ 1.0.0-alpha4-10326)'.
'Microsoft.Framework.DependencyInjection' already has a dependency defined for 'Microsoft.Framework.ConfigurationModel'.
This was resolved by installing the latest NuGet Package Manager:
https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
Don't forget to restart Visual Studio.
I fixed a similar issue in my solution by:
Opening up a command prompt
Navigating to the .nuget folder in my solution
Running nuget update -self
This upgraded the copy of NuGet.exe that was in my solution from 2.8.0 to 3.4.4, which fixed the 'X' already has a dependency defined for 'Y' error that was stopping it from downloading SSH.NET automatically before building.
(If your solution doesn't have a copy of NuGet.exe in it - and it might not - then you should try the solution in TN's answer instead)
I tried the update, but it did not work for me. Helped:
Uninstall NuGet => Tools => Extensions and update => Installed
Install NuGet
Reload Visual Studio
I faced this error on outdated version of Visual Studio 2010. Due to project configuration I was not able to update this version to newer. Therefore, update of NuGet advised above did not fix things for me.
Root reason for the error in this and similar situations is in dependencies of the package you try to install, which are not compatible with .NET version available in your project.
Universal solution is not obligatory update of Visual Studio or .NET but in installation of older NuGet versions of the same package compatible with your system.
It is not possible to tell for sure, which of earlier versions will work. In my case, this command installed the package without any NuGet updates.
Install-Package X -Version [compatible version number]
I was getting this issue on our TeamCity build server. I tried updating NuGet on the build server (via TC) but that didn't work. I finally resolved the problem by changing the "Update Mode" of the Nuget Installer build step from solution file to packages.config.
I was getting the issue 'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp' on the TeamCity build server.
I changed the "Update Mode" of the Nuget Installer build step from solution file to packages.config and NuGet.exe to the latest version (I had 3.5.0) and it worked !!
Go to the link https://www.nuget.org/packages/ClosedXML/0.64.0
Search your NuGet packages
See the all version of related packages
Install the lower version of packages
In my case I had to delete the file NuGet.exe in the Project folder/.nuget and rebuild the project.
I also have in NuGet.targets the DownloadNuGetExe marked as true:
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
Hope it's helps.
The only solution that worked for me was to uninstall nuget completely from Visual Studio 2013 and then install it again with the obligatory restart of VS in between.
Go to Tools.
Extensions and Updates.
Update Nuget and any other important feature.
Restart.
Done.
In a project using vs 2010, I was only able to solve the problem by installing an older version of the package that I needed via Package Manager Console.
This command worked:
PM> Install-Package EPPlus -Version 4.5.3.1
This command did not work:
PM> Install-Package EPPlus -Version 4.5.3.2

Not able to Install Unity in VS2010

I am trying to install Unity from Nugget in VS2010 and receiving following error:
Could not install package 'Unity 3.5.1404.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.
Any Idea what could be Wrong?
I understand this package is not for VS2010 but for VS2012 or later. What is the way to get this package for VS2010 or VS2008?
Cheers
The problem is that Unity 3.5 requires .NET 4.5.

Resources