Reputation: 60
I had this error while trying to install Nuget package "RazorGenerator.Mvc" with the specific version 2.3.12 using this command:
Install-Package RazorGenerator.Mvc -Version 2.3.12
However, when running the command, Visual Studio returned this error:
Failed to add reference. The package 'RazorGenerator.Mvc' tried to add a framework reference to 'System.Web.Mvc' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance. Cannot find assembly 'System.Web.Mvc'.
My project already has the package "Microsoft.AspNet.Mvc" installed with the latest version, I have also tried installing this package with version 3.0.50813.1 but both attempts didn't resolve the error. Do you guys have any idea how to fix this issue? The specific version of the package "RazorGenerator.Mvc" has to be 2.3.12.
Upvotes: 1
Views: 339
Reputation: 60
For anyone wondering, I have resolved this error. Somehow I couldn't use Nuget package manager to install "RazorGenerator.Mvc" to the correct version "2.3.12" - the installed RazorGenerator package was of a different version, I couldn't uninstall it nor update to 2.3.12 because of dependencies from other packages. However, I have resolved the issue by updating this line in "packages.config" and rebuild the solution.
<package id="RazorGenerator.Mvc" version="2.3.12" targetFramework="net48" />
After this, the version of "RazorGenerator.Mvc.dll" in my bin folder, and the version in Nuget was "2.3.12".
Upvotes: 0
Reputation: 2507
You can try any of these 3 things:
From Nuget package manager, Uninstall the package "Microsoft.AspNet.Mvc" from your project and then try installing the specific version of the package "RazorGenerator.Mvc" i.e. 2.3.12 (RazorGenerator.Mvc will install all the dependencies)
Cross check whether it is not your target framework of the project that is causing this issue. In short, check whether you need your project with .Net Framework or .NetCore in order to install this nuget package.
Remove any dlls,exe from bin/ debug folder and try installing the nuget again.
Upvotes: 1