7

I'm reading a blog on how to add MVC functionalities to an existing WebForm application. I've created a WebForm Application. To proceed further, I need to add a number of references to assemblies.

I've been able to add them all, but the System.Web.MVC. There's no such assembly in the Add Reference Dialog box. But, the sample code that I downloaded contains a reference to that assembly.

Any how to overcome that problem?

GEOCHET
  • 20,623
  • 15
  • 71
  • 98
Richard77
  • 17,505
  • 36
  • 124
  • 222

2 Answers2

12

Depending on the version of Visual Studio you are using, the MVC framework may not automatically be installed on your computer.

Check here to make sure you have the latest MVC installed

Additional suggestions:

  1. When you go to Project->Add Reference make sure you wait for the list to fully populate and then click the System Component column header (the list is not alphabetized by default). System.Web.MVC should show up between System.Web.Mobile and System.Web.RegularExpression. You will not find System.Web.MVC there if you do not sort the column (even when you reopen the reference list).

  2. If that still does not solve the problem then I would suggest a reinstall or simply dl MVC 3 if it isn't already installed (only MVC 2 will be installed by default) and that should add the System.Web.MVC to your references.

CodeGuru
  • 301
  • 2
  • 4
  • I'm using Visual Studio 2010 Professional Edition. When I do Menu->New, I'm proposed the ASP.NET MVC 3 template. I guess My VS version has MVC on it. Right? – Richard77 May 21 '11 at 20:10
  • You are right. All I needed to do is click the System Component header. Then everything was sorted out. Thank you very much. – Richard77 May 23 '11 at 02:52
0

I answered to same question here. But I repeated my answer:

Check these step:

  1. Check is MVC is installed properly.
  2. Check the project's property and see what is the project Target Framework. If the target framework is not set to .Net Framework 4, set it.

Note: if target framework is set to .Net Framework 4 Client Profile, it will not list MVC reference on references list. You can find different between .Net Framework 4 and .Net Framework 4 Client Profile here.

The .NET Framework 4 Client Profile is a subset of the .NET Framework 4 that is optimized for client applications. It provides functionality for most client applications, including Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables faster deployment and a smaller install package for applications that target the .NET Framework 4 Client Profile.

Community
  • 1
  • 1
Iman
  • 439
  • 4
  • 19