ASP.NET Web Pages (Razor) (solution for Could not load file or assembly 'System.Web.Helpers, Version=1.0.0)

Programming, error messages and sample code > ASP.NET

What's the difference between ASP.NET Web Pages, ASP.NET Web Forms, and ASP.NET MVC?

All three are ASP.NET technologies for creating dynamic web applications:

  • ASP.NET Web Pages focuses on adding dynamic (server-side) code and database access to HTML pages, and features simple and lightweight syntax.

  • ASP.NET Web Forms is based on a page object model and traditional window-type controls (buttons, lists, etc.). Web Forms uses an event-based model that's familiar to those who've worked with client-based (Windows forms) development.

  • ASP.NET MVC implements the model-view-controller pattern for ASP.NET. The emphasis is on "separation of concerns" (processing, data, and UI layers).

All three frameworks are fully supported and continue to be developed by the ASP.NET team. In general, the choice of which framework to use depends on your background and experience with ASP.NET.

ASP.NET Web Pages in particular was designed to make it easy for people who already know HTML to add server processing to their pages. It's a good choice for students, hobbyists, people in general who are new to programming. It can also be a good choice for developers who have experience with non-ASP.NET web technologies.

 

Using Visual Studio with Different Versions of ASP.NET Web Pages

Visual Studio 2012 and Visual Studio 2013 include support for ASP.NET Web Pages. (The packages that are required in order to support ASP.NET Web Pages are installed when you install Visual Studio.) 

Visual Studio 2010 does not include support by default for ASP.NET Web Pages. To use ASP.NET Web Pages with Visual Studio 2010, you must install the ASP.NET MVC package.  To get ASP.NET Web Pages 2, you install ASP.NET MVC 4.

The following table summarizes the support for ASP.NET Web Pages in different versions of Visual Studio.

  Visual Studio 2010 Visual Studio 2012 Visual Studio 2013
ASP.NET Web Pages 2 Install ASP.NET MVC 4 (Included) (Included)
ASP.NET Web Pages 3   Update to
ASP.NET
Web Pages 3
through NuGet
(Included)

To work with Visual Studio 2010, see Installing Support for ASP.NET Web Pages in Visual Studio 2010.

 

Running Different Verrsions of ASP.NET Web Pages (Razor) Side by Side

ASP.NET Web Pages supports the ability to run websites side by side. This lets you continue to run your older ASP.NET Web Pages applications, build new ASP.NET Web Pages applications, and run all of them on the same computer.

Here are some things to remember when you install the Web Pages with WebMatrix:

  • By default, existing Web Pages applications will run as the latest version on your computer. (The assemblies are installed in the global assembly cache (GAC) and are used automatically.)

  • If you want to run a site using a different version of ASP.NET Web Pages, you can configure the site to do that. If your site doesn't already have a web.config file in the root of the site, create a new one and copy the following XML into it, overwriting the existing content. If the site already contains a web.config file, add an <appSettings> element like the following one to the <configuration> section.

    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="webPages:Version" value="1.0"/>
      </appSettings>
    </configuration>
  •  
  • If you do not specify a version in the web.config file, a site is deployed as the latest version. (The assemblies are copied to the bin folder in the deployed site.)

  • New applications that you create using the site templates in Web Matrix include the Web Pages version assemblies in the site's bin folder.

In general, you can always control which version of Web Pages to use with your site by using NuGet to install the appropriate assemblies into the site's bin folder.