简体   繁体   中英

Where can I find System.Web.Helpers, System.Web.WebPages, and System.Web.Razor?

I am following this article on RazorGenerator and it say's that I must add references to:

  • System.Web.Helpers.dll
  • System.Web.WebPages.dll
  • System.Web.Razor.dll

The only one I can see when I do Add Reference is System.Web.Razor , but I don't know where the other ones are.

您将在Visual Studio 2010,2012和2013中的程序集下的“扩展”组中找到这些程序集(参考管理器)

I had the same problem , first I couldn't find those dlls in the list of .NET components . but later I figured it out that the solution is :

1- first I changed target framework from .NET framework 4 client profile to .NET framework 4 .

2- then scroll down the list of .NET components , pass first list of system.web. .. , scroll down , and find the second list of system.web. .. at the bottom , they're there .

I hope this could help others

In VS 2010 just right click on project or on reference and click add reference. On the popup window Select Assemblies - > Extensions -> System.Web.Helpers

至于VS2017,我没有在“扩展”中找到它,有一个名为“ microsoft-web-helpers ”的Nuget包似乎等同于System.Web.Helpers。

这里安装ASP.NET MVC3应该有所帮助。

To sum up all of the options for VS 2017, WebHelpers was installed by installing MVC in previous versions of Visual Studio. If you're getting this error, you probably don't have the older versions of VS installed anymore.

So, installing the Microsoft.AspNet.MVC NuGet package will require Microsoft.AspNet.WebPages and Microsoft.AspNet.Razor , and the Microsoft.AspNet.WebPages includes System.Web.Helpers.dll .

If you've got direct references to System.Web.Mvc.dll and you don't want to use NuGet for MVC, you can get the Microsoft.AspNet.WebPages NuGet, or there are some other NuGet packages that only contain System.Web.Helpers.dll , like the microsoft-web-helpers or System-Web-Helpers.dll packages.

There appear to be 2 versions of System.Web.Helpers.dll , one for .Net 4.0 and one for 4.5. Choosing the correct version of MVC or AspNet.WebPages will ensure you get the right one.

I had to install RazorGenerator.Templating to get it all to work. From the NuGet console, type:

Install-Package RazorGenerator.Templating

The issue is a missing or outdated version of MVC. I was running VS 2015Preview and could resolve the issue by installing the latest version of MVC via NuGet.

Just in case anyone is still coming across this one.

On VS2017 I installed the NuGet package: Microsoft.AspNet.WebPages

That did the trick.

在MVC3或WebPages的子文件夹中,它们应位于C:\\Program Files\\Microsoft ASP.Net (或C:\\Program Files (x86)\\Microsoft ASP.Net如果您使用的是64位操作系统)。

当您安装此nuget包Microsoft.AspNet.WebPages时,可以在C:\\ Program Files(x86)\\ Microsoft Visual Studio \\ Shared \\ Packages \\ Microsoft.AspNet.WebPages.xxx \\ lib \\ net45中找到它们

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM