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.
Install packages from NuGet.orgSelect Package Manager, and then copy the Install-Package command. In Visual Studio, select Tools > NuGet Package Manager > Package Manager Console to open the package manager console. Paste the command into the Package Manager Console and then press Enter.
NuGet is a package manager that delivers compiled source code (DLLs) and other files (scripts and images) related to code. A NuGet package takes the form of a zip file with the extension . nupkg. This makes adding, updating, and removing libraries easy in Visual Studio applications.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With