Could not install Microsoft.AspNet.Razor 3.0.0
Asked Answered
A

1

15

I am working on an ASP.NET project in which I need to do simple HTML templating.

The prettiest solution seems to be RazorEngine, which depends on Microsoft.AspNet.Razor. However, when trying to install Microsoft.AspNet.Razor via Nuget, the following error message is shown:

Installing 'Microsoft.AspNet.Razor 3.0.0'.
Successfully installed 'Microsoft.AspNet.Razor 3.0.0'.
Adding 'Microsoft.AspNet.Razor 3.0.0' to EBulkDBSManagementApp.
Uninstalling 'Microsoft.AspNet.Razor 3.0.0'.
Successfully uninstalled 'Microsoft.AspNet.Razor 3.0.0'.
Install failed. Rolling back...
Could not install package 'Microsoft.AspNet.Razor 3.0.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 solution?

Audiovisual answered 4/11, 2013 at 11:9 Comment(0)
D
29

The latest RazorEngine 3.4.0 NuGet package depends on the Microsoft.AspNet.Razor 3.0.0 NuGet package which requires .Net 4.5

If you wish to use RazorEngine with a version of .NET prior to 4.5, then you will need to use the RazorEngine 3.3.0 NuGet pacakage.

You can install this using the package manager console with the following command.

Install-Package RazorEngine -Version 3.3.0
Devise answered 6/11, 2013 at 15:14 Comment(3)
If 3.3.0 does not work either, use "Install-Package RazorEngine -Version 2.1.0" instead.Finer
There is a nuget legacy package for ASP.NET MVC 4, it uses RazorEngine v2.1.0.Hollyhock
How do you know this? This works perfect for me. But wondering in Nuget website, 3.2.3 is the latest stable nuget.org/packages/Microsoft.AspNet.RazorEckenrode

© 2022 - 2024 — McMap. All rights reserved.