NuGet Issue installing SignalR and Raven - ravendb

I am trying to use NuGet to add SignalR and Raven to a new ASP.Net MVC 4 project.
If I do SignalR first, then try to add Raven I get the following error:
Install failed. Rolling back... Install-Package : Already referencing
a newer version of 'Newtonsoft.Json'.
If I install Raven first, then SignalR I get:
Install failed. Rolling back... Install-Package : Updating
'Newtonsoft.Json 4.5.7' to 'Newtonsoft.Json 4.5.8' failed. Unable to
find a version of 'RavenDB.Client' that is compatible with
'Newtonsoft.Json 4.5.8'.
I thought NuGet was meant to handle this sort of thing?
How can I get them both added?

It appears that RavenDB.Client has an exact-version constraint on Newtonsoft.Json = 4.5.7, while SignalR has a more relaxed constraint of '4.5.4 or higher' (actually a constraint imposed by one of its own dependencies, SignalR.Server).
I managed to get your above scenario working with some manual tweaking:
Created new MVC4 project
Opened up packages.config and added an 'allowedVersions="[4.5.7]"' attribute to the Newtonsoft.Json package entry
Opened the package manager console (View... Other windows... Package Manager Console) and ran update-packages to pull in latest code for all default dependencies (takes a while)
Again in package manager console, ran install-package RavenDB.Client
Finally in package manager console, ran install-package SignalR
I tried a few combinations of ordering the above but it wasn't liking it - the thing that let it work seems to be the manual editing of packages.config to lock the version of Newtonsoft.Json to 4.5.7 so that subsequent installs don't trash the referenced version.

We ran into this exact issue, but ultimately pulled in the Raven assemblies manually (so we could target a specific version).
Something that we came across is that it is possible to force Nuget to install a package using the command line tools:
How to install an older version of package via NuGet?

I ran into the same issue, but instead decided to install an older version of SignalR. Version 4.0 (February 2012) has a dependency on NewtonSoft >= 4.0.7, and this installs correctly with RavenDB already installed:
Install-Package SignalR -Version 0.4.0

I got the same problem with Raven and the standard MVC template. I wanted the latest version of Newtonsoft.Json so I solved it differently.
I checked what dependencies RavenDB Client had and then installed the latest version of them first Newtonsoft.Json and NLog
I then installed the packet in the Packet manager Console with the -IgnoreDependencies flag.
Install-Package -Id RavenDB.Client -IgnoreDependencies
That worked fine. (I am taking a calculated risk that RavenDB is not compatible with the latest Newtonsoft.Json at the moment. But I am a Daredevil)

Related

the project must provide a value for configuration Error when install Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation in Core3.1

When I install Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation in a Web project and in Startup add :
services.AddMvc().AddRazorRuntimeCompilation();
,the project does not run and the error is:
the project must provide a value for configuration
my .NET-Core version is 3.1
How can this be fixed?
There are some GitHub issues with this problem and some solutions that have worked for people. That said I would check to see that all NuGet packages are on versions supported by .NET Core 3.1. At this particular moment that means not too new so as to only work with .NET 5 and not too old so as to only work with Core 2.2.
Otherwise, someone suggested restarting VS.
https://github.com/dotnet/sdk/issues/9932
You may also try deleting Microsoft.AspNetCore.Razor.Design from the CsProj file per this duplicate question

Understanding ASP.NET Core Patch Version Roll Forward

I'm trying to understand how the roll-forward mechanism with Microsoft.AspNetCore.App is supposed to work along with other nuget packages.
My understanding so far is that any time I publish my app, .netcore will automatically publish the app on the latest patched version that I have installed. This doesn't sound like a good practice to me. I think the application should be deployed on the .net version that it was developed on.
I recently ran into a problem where my build server has a newer SDK installed than I have on my development machine, so it tried to publish the app with a newer .netcore version.
This caused the build to break with the following error:
error NU1605: Detected package downgrade: Microsoft.EntityFrameworkCore.Design from 2.1.8 to 2.1.4. Reference the package directly from the project to select a different version.
I have explicitly specified that I want version 2.1.4 of Microsoft.EntityFrameworkCore.Design because that was the latest version that was available when I originally developed the application.
I feel like I'm missing something here. Am I supposed to make sure that I always
have the same SDK installed locally as the build server and that all of my apps are updated to the latest SDK every time I need to make a change? What if a co-worker wants to write a .netcore app targeting a newer version of the framework so they request that a new SDK be installed on the build server? Surely I shouldn't have to also update my app to the latest patch version.
You experienced the problem because when you reference the versionless Microsoft.AspNetCore.App you shouldn't reference packages which already are pulled in by the metapackage.
Because the metapackage already contains Microsoft.EntityFrameworkCore.Design and you specified a hard version you got a version conflict.
This usually happens when you have one project with the metapackage in another (for example test project) have a specified version. What happens then is that when building it will determine the highest version and use that but when it gets to the test project it will need to downgrade (because of the specified version) and will throw a build error. The recommended way until 3.0 is to add <Project Sdk="Microsoft.NET.Sdk.Web"> to the test project and also use the metapackage.
As far as I know it works like this: When you reference Microsoft.AspNetCore.App it will take the lowest possible version it can. So if for example your targetframework is netcoreapp2.1 then it will take 2.1.1. When it builds it will look what the highest possible version is of the shared framework you have installed for and use that. If you have the following runtimes installed: 2.2.0, 2.1.5, 2.1.12 it will roll forward to 2.1.12. There are some additional roll forward policies having to do with the minor (if its a preview version or not ect.) but those only happen when it can't find a runtime corresponding to the major and minor version.
See also: https://github.com/aspnet/AspNetCore/issues/3292 and https://github.com/aspnet/AspNetCore.Docs/issues/6430

'MySql.Data' already has a dependency defined for 'System.Text.Encoding.CodePages' [duplicate]

I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it fails.
It says:
Operation failed
'AutoMapper' already has a dependency defined for
'Microsoft.CSharp'.
I'm able to add other dependencies.
I'm using the last version of the package manager for VS 2012:
NuGet Package Manager 2.8.60318.667
Any ideas what should I check?
The problem is that your NuGet Package Manager is too old. You need NuGet 2.12 since this supports the newer .NETStandard frameworks that the AutoMapper 5.0.1 NuGet package is using.
The AutoMapper has a group dependency which specifies a target framework of .NETStandard. Since your version of NuGet Package Manager is too old it does not recognise this target framework and converts it to an Unknown target framework and you end up with duplicate frameworks since there .NETStandard is used a few times in that NuGet package. This causes the error:
'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'
Unfortunately NuGet 2.12 is not available for Visual Studio 2012 but is available for Visual Studio 2013.
So either you need to update to Visual Studio 2013 or above, or you will have to use the older AutoMapper NuGet package which does not support .NETStandard.
Seems to be a problem with the current version of automapper:
AutoMapper 5.0.0 Tuesday, June 28, 2016
I tried with the previous version and it works:
PM> Install-Package AutoMapper -Verbose
Install-Package : 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:16
+ Install-Package <<<< AutoMapper -Verbose
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> Install-Package AutoMapper -Version 4.2.1
Installing 'AutoMapper 4.2.1'.
Successfully installed 'AutoMapper 4.2.1'.
So, if you can't update NuGet Package Manager, the answer is:
PM> Install-Package AutoMapper -Version 4.2.1
I ended up needing to update NuGet.exe that was included in the solution to be able to build NuGet packages by running:
nuget.exe update -self
I had the same issue on VS2013. I had to update to VS2013 Update 5 and get the latest nuget distro for VS2013 at
https://dist.nuget.org/visualstudio-2013-vsix/v2.12.0/NuGet.Tools.vsix
Once that was done, I rebooted Visual Studio. After that I was able to use the Automapper 5.0.2 package
Go to Visual Studio > Tools > Extension and Updates
Find Updates in left accordion menu, Go to Visual Studio Gallery.
You will find a update for Nuget.
Update the nuget package and try installing or builing the project.
Thanks,
GT
An other workaround if you're stuck with VS2012 and the old Nuget version:
Find the Cache folder of VS 2012's Nuget Package Manager (with Tools - Options - Nuget Package Manager)
Open AutoMapper.5.x.x.nupkg with your favorite Zip Tool
Modify the file AutoMapper.nuspec - I simply deleted all dependencies except .NETFramework4.5
Add the cache folder as a Nuget source (also in Tools - Options - Nuget Package Manager)
Install Automapper either with the console or the GUI but make sure to choose first the newly added cache folder as package source.
Of course, the next version of Automapper probably needs to be adapted, too, in order to install it.
This looks like a mismatch between the .NET version used by the Automapper package and your project. Can you confirm the .NET version that your project is using?
Automapper 6.0.2 - nuget 2.8.8 gives this error. Needed to update to 3.4.4 to get this working.
Removed both CSharp and AutoMapper. Installed CSharp (4.0.0.0) first and then added Automapper (6.1.1.0). This resolved the problem for me.
I observed this exact problem when opening a project with Visual Studio 2010.
After opening with VS2017, I was able to install AutoMapper without any error.

Nuget External packages cannot depend on packages that target projects

When I attempt to Install-Package Twitter.Bootstrap in an empty mvc4 web project I get this
Install-Package Twitter.Bootstrap
Attempting to resolve dependency 'bootstrap (≥ 3.0.1)'.
Attempting to resolve dependency 'jquery (≥ 1.9.0)'.
Install-Package : External packages cannot depend on packages that target projects.
At line:1 char:1
+ Install-Package Twitter.Bootstrap
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
What can I do to fix this
?
I had the same problem, this work for me:
Install-Package Bootstrap
"As of v3.0.1.1 the Twitter.Boostrap package will begin redirecting users to the Bootstrap package managed by the Outercurve foundation. The reason for this move is pretty simple. Bootstrap is a cleaner namespace since the project dropped the twitter name a few releases ago and Bootstrap now officially ships with the Visual Studio 2013 ASP.Net templates. So to avoid confusion on which release is "official", we've agreed to redirect everyone over to the new Microsoft maintained namespace."
http://chriskirby.net/bootstrap-nuget-package-moving-to-outercurve/
https://github.com/sirkirby/twitter-bootstrap-nuget/issues/22
I encountered the same error with both VS 2010 and VS 2012. The suggested solution did not solve the problem, but I did notice that the NuGet Package for Bootstrap is dated Nov 1, 2013 (yesterday). The new package has version number 3.0.1.1 and it lists a dependency of Bootstrap version 3.0.1 or higher. It appears there is an error in version 3.0.1.1 of this package with a circular reference in the dependency. Look for version 3.0.1 by the same authors.
I am assuming you are using Visual Studio 2012. In VS2012 new MVC4 projects are loaded with jquery 1.7 by default. But Bootstrap 3.0.1 has a dependency on jquery 1.9 or higher
So first run
update-package jQuery
and then
install-package twitter.bootstrap
I had the same problem. After I updated NuGet Manager, it solved by problem. To update NuGet Manager, you can to Tools -> Extensions and Updates
I had the same problem when installing Bootstrap 3.0.1.1. It does look like it is looking for 3.0.1 for its dependency. I at the end installed 3.0.0 with no problem.
I had this same problem that brought me to this question. In Package Manager I searched for bootstrap and there were several results returned.
I clicked on the on at the top of the list and tried to install this one (version 3.0.1.1) and received the error reported in the original question. The ID of this package is Id: Twitter.Bootstrap
There was another Bootstrap package listed with version 3.0.2 with Id: bootstrap
I installed the second one v. 3.0.2 and this installed without any issues.
Taken from fontawesome:
"The folks at Outercurve have taken over support for the Twitter.Bootstrap package now being called simply bootstrap.
More info here http://chriskirby.net/bootstrap-nuget-package-moving-to-outercurve/"
It would seem to me that the redirect to the new Microsoft maintained namespace is causing this to happen.
My Problem perfectly solved
Try
Install-Package Bootstrap
Instead of
Install-Package Twitter.Bootstrap
refered post:
Bootstrap v3.0.1.1 fails on clean VS empty project - how to resolve?$privUrl
how to launch Package Manager console
http://docs.nuget.org/docs/start-here/using-the-package-manager-console
just try installing Twitter bootstrap MVC with NuGet Package Manager and enjoy
Just try update vs2012 !I resolved it!
I updated VS2012 to VS2013. It resolved the problem
I also had the same issue. But resolved when updated the Nuget Manager and tried again after that.

ServiceStack Redis Client Expecting Older version of ServiceStack.Common

I just NuGetted ServiceStack.Redis 3.1.3 but as its dependencies it also gets ServiceStack.Common and ServiceStack.Text 3.1.6
Now when I build the application everything is OK.
But, when I run the application some of the Redis Client methods execute properly but some of them e.g. (RedisClient.GetAllKeys) gives throws the exception
Could not load file or assembly 'ServiceStack.Common, Version=1.0.4336.27526, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Then i removed all the dll's and nuget packgage config, and explicitly did a NuGet ServiceStack.Common -Version 3.1.3 and got it. But then when i tried to NuGet ServiceStack.Redis -Version 3.1.3 it automatically removed the 3.1.3 version of Common and downloaded the 3.1.6 version !!!
Arrrghhh, I hate over intelligent installers.
How do I fix this ?
Does the publisher of ServiceStack even know about this issue ??
Ok ! Found the Issue.
I was trying to use ServiceStack from a console application and it was configured to build in "ClientProfile" mode.
ServiceStack internally references System.Web which wasn't being accessible at runtime.
I switched the Application to Build using the full framework mode and everything works ok now.
Thanks anyways mythz !
Nope, ServiceStack was not aware of this issue. Though we'd like to know what's causing it.
I've tried a fresh install of ServiceStack.Redis and it works as expected.
To remove your dlls you need to go into NuGet package manager and finding the installed ServiceStack.Redis Package and clicking un-install. This should ensure the next install of the Project downloads it from the NuGet website and doesn't re-use your dirty dll cache.
Failing that ensure you have the latest version of NuGet and that your old NuGet caches are cleared. i.e. find and delete the NuGet /packages folder.