Reputation: 165
I tried the following:
I am trying to open a code set created in VS 2010 (pluralsight exercise) in VS Community 2015.
The System.Web.Mvc reference was showing up with an error due to which the code won't compile. I tried to update the NuGet Microsoft.AspNet.MVC to current version - 5.2.3 and got the below error:
Could not install package 'Microsoft.AspNet.Razor 3.2.3'. 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.
Microsoft.AspNet.MVC v4.0.40804
Microsoft.AspNet.Razor v2.0.30506
Microsoft.AspNet.Webpages v2.0.20710
I would like to know how the NuGets can be updated to their latest stable version.
Upvotes: 5
Views: 11617
Reputation: 24957
AFAIK Microsoft.AspNet.Mvc 5.2.3
& Microsoft.AspNet.Razor 3.2.3
packages contains only .NET 4.5 assemblies, and hereby can't be installed on any project which has targetFramework=4.0
in web.config file even they're succeeded to add inside Package Manager Console.
If you're willing to change target framework version, edit targetFramework
attribute value on both compilation
& httpRuntime
element in your project to use .NET 4.5 assemblies, or use project properties => Application
=> Target framework
=> .NET Framework 4.5
:
<compilation targetFramework="4.5">...</compilation>
<httpRuntime targetFramework="4.5" />
NB: The latest compatible Razor engine version for Microsoft.AspNet.Mvc 4.040804
is 2.0.30506.0. Unfortunately as of now package's metadata doesn't have any info for supported target frameworks, hence you need to find out which packages fit to your project by yourself.
Related issue:
Dependencies of .NET Framework (Issue #878)
Upvotes: 5