I got this error while installing the sitemapprovider for mvc:
Install-Package : Updating 'Microsoft.AspNet.Razor 3.2.2' to 'Microsoft.AspNet.Razor 2.0.20505.0' failed. Unable to find versions of
'Microsoft.AspNet.WebPages, Microsoft.AspNet.Mvc' that are compatible with 'Microsoft.AspNet.Razor 2.0.20505.0'.
At line:1 char:1
+ Install-Package MvcSiteMapProvider.MVC4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
The error indicates you are installing the MvcSiteMapProvider.MVC4 NuGet package, but your project is MVC 5 (because it has Razor 3.2.2). You must install the package that matches your version of MVC (in this case, MvcSiteMapProvider.MVC5) into your project.
PM> Install-Package MvcSiteMapProvider.MVC5
Do note that the MvcSiteMapProvider NuGet package is obsolete and should not be installed into any project unless you intend to use MvcSiteMapProvider v3.x.
If you are upgrading from MvcSiteMapProvider v3 to v4, please see the upgrade guide.
Related
I am getting the following error while installing the lib.web.mvc.6.8.2 package with VS 2017. It seems there is an issue with the dependency Microsoft.AspNet.Mvc already installed:
PM> Install-Package Microsoft.AspNet.Mvc
Package 'Microsoft.AspNet.Mvc.5.2.3' already exists in project 'MyMVCApplication' Time Elapsed: 00:00:00.6708551
PM> Install-Package Lib.Web.Mvc -Version 6.8.2
Attempting to gather dependency information for package
'Lib.Web.Mvc.6.8.2' with respect to project 'MyMVCApplication',
targeting '.NETFramework,Version=v4.5.2'
Gathering dependency information took 8,86 sec
Attempting to resolve dependencies for package 'Lib.Web.Mvc.6.8.2'
with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Lib.Web.Mvc.6.8.2'
Resolved actions to install package 'Lib.Web.Mvc.6.8.2'
Retrieving package 'Lib.Web.Mvc 6.8.2' from 'nuget.org'. Install
failed. Rolling back...
Package 'Lib.Web.Mvc.6.8.2 : Microsoft.AspNet.Mvc [4.0.0, 6.0.0)' does not exist in project 'MyMVCApplication'
Package 'Lib.Web.Mvc.6.8.2 : Microsoft.AspNet.Mvc [4.0.0, 6.0.0)' does
not exist in folder 'C:\Users\Cyberphil83\documents\visual studio
2017\Projects\MyMVCApplication\packages'
Executing nuget actions took 19,84 ms Install-Package : Could not
install package 'Lib.Web.Mvc 6.8.2'. 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.At line:1 char:1
+ Install-Package Lib.Web.Mvc -Version 6.8.2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I checked the github of this project, and it looks like it is targeting .NET 4.6:
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
Lib.Web.Mvc.csproj
But your app is targeting 4.5.2.
So you have few options. One of them is to clone/fork this project and compile targeting 4.5.2. Or simply change your app to 4.6 (if possible?).
Since v6.8.0 release Lib.Web.Mvc requires .NET 4.6+ as it requires HTTP/2 support.
There is a v6.7.x branch which is fix-only branch supporting .NET 4.0+.
If you want to stick to .NET 4.5.2 you will have to use latest 6.7.x version:
PM> Install-Package Lib.Web.Mvc -Version 6.7.1
Alternative is to upgrade your project to .NET 4.6+.
After opening VS 2010, I created an empty MVC 4 Web app 'UmbracoTest' along with a new solution. View engine is Razor and .Net 4. In Package Manager console, I typed PM>install-package umbracocms and prompt this:
PM> install-package umbracocms
Attempting to resolve dependency 'UmbracoCms.Core (= 7.5.4)'.
Attempting to resolve dependency 'Microsoft.AspNet.Mvc (≥ 5.2.3 && < 6.0.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.Razor (≥ 3.2.3 && < 3.3.0)'.
...
...
Installing 'Microsoft.AspNet.Razor 3.2.3'.
Successfully installed 'Microsoft.AspNet.Razor 3.2.3'.
...
...
Removing 'Microsoft.AspNet.Razor 2.0.20710.0' from UmbracoTest.
Successfully removed 'Microsoft.AspNet.Razor 2.0.20710.0' from UmbracoTest.
Adding 'Microsoft.AspNet.Razor 3.2.3' to UmbracoTest.
Uninstalling 'Microsoft.AspNet.Razor 3.2.3'.
Successfully uninstalled 'Microsoft.AspNet.Razor 3.2.3'.
Install failed. Rolling back...
Install-Package : Could not install package 'Microsoft.AspNet.Razor 3.2.3'. You are trying to install this package into a project that targets '.NETFramewo
rk,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.
At line:1 char:16
+ install-package <<<< umbracocms
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM>
As the error says: You are trying to install this package into a project that targets '.NETFramework,Version=v4.0'. Umbraco depends on ASP.NET MVC 5 which doesn't work on .NET 4.0. In fact, VS2010 does not support .NET 4.5. Instead you will need Visual Studio 2012 or higher.
There is a free community edition download of Visual Studio available if you're a student, open source developer or individual developer.
I just upgrade my project from Visual Studio from 2010 to 2013 to support Cross-Origin Resource Sharing (CORS) in my WebApi.
Now when I am installing Microsoft.AspNet.WebApi.Cors package from NuGet then I am getting following error.
I am using Visual Studio 2013, Asp.Net MVC 5
PM> Install-Package Microsoft.AspNet.WebApi.Cors
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 5.2.3 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.3)'.
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package Microsoft.AspNet.WebApi.Cors
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I had exact the same problem with another NuGet library.
Please try this steps:
1. Updates
Proof if your installed NuGet version is on the newest version
2. Clear cache
Use the NuGet command prompt and clear the cache:
You can list the local caches with this command:
nuget locals all -list
You can clear all caches with this command:
nuget locals all -clear
3. Check cache
The NuGet Cache is simply a folder on your computer, you can proof delete the remaining files manually under %LOCALAPPDATA%\NuGet\Cache.
Or just run this in administrator CMD:
del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
The message says the package is already installed.
try uninstall before to re-install:
Uninstall-Package Microsoft.AspNet.WebApi.Cors
If that can help someone else, I tried to follow the steps from Steffen Mangold but that's wasn't working completely.
If you have an assembly error like:
System.Web.Http, Version=5.0.0.0
after doing this command Install-Package Microsoft.AspNet.WebApi.Cors
Try that :
1 - Run this in administrator CMD
del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
2 - Run this in the Package manager console
Install-Package Microsoft.AspNet.WebApi
That will install missing assemblies and fix the error.
Check the package source.
Go to tools, click on Nuget Package Manager and click on Package Manager settings.
Then go to Package Sources subsection under the Nuget Package Manager section.
In my case the source was initially pointing to a folder on my local machine.
So just add another package source with the following details.
Name : nuget.org
Source : https://api.nuget.org/v3/index.json
I'm using Visual Studio 2015 and windows 10.
I created a new web project (MVC) with no authentication, I Tried to install EntityFramework 6.1.3 with this command in package manager "Install-Package EntityFramewor" but I got this error :
Type 'get-help EntityFramework' to see all available Entity Framework
commands. Package 'EntityFramework 6.1.3' does not exist in folder
'C:\Projects\WebApplication1\packages' Install-Package : Object
reference not set to an instance of an object. At line:1 char:1
+ Install-Package EntityFramework -Version 6.1.3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I can install EntityFramework 6.1.2 without any problem.
using manage Nuget package install entityframework 6.1.2 then update it to 6.1.3.
I'm trying to install Castle Windsor 3.0 using NuGet, and it fails with the following message:
PM> Install-Package Castle.Windsor
'Castle.Core (≥ 3.0.0)' not installed. Attempting to retrieve dependency from source...
Done.
Install-Package : Id is required.
Version is required.
Authors is required.
Description is required.
At line:1 char:16
+ Install-Package <<<< Castle.Windsor
+ CategoryInfo : NotSpecified: (:) [Install-Package], ValidationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.Cmdlets.InstallPackageCmdlet
I've tried it both using the command-line (above) and using the Library Package Manager.
My environment is a default MVC3.0 installation, using the web site template, in Visual Studio 2010, with absolutely nothing changed from the defaults.
The error looks like there is something wrong with the package being downloaded from NuGet.
Can anyone shed any light on this? I can work around it with a manual install of Castle Windsor, but would like to use NuGet if possible.
Thanks in advance for any suggestions.
Update NuGet to the latest version. I recently upgraded from 1.3 to 1.6, but had to completely reinstall (as administrator) to get my project working. I think it was for a FluentValidation.MVC3 project I was whipping up.
I had the same problem even having the latest version of NuGet. I had to settle for:
Install-Package Castle.Core -Version 2.5.2