6

My MVC 3 project is building successfully in my development machine with Visual Studio 2010 + MVC 3. In the build server, VS2010 is not used and I've installed 'ASP.NET MVC 3 Tools Update'. I've also downloaded NAnt and used TortoiseSVN to checkout all the files except bin directories.

But while building using Nant default.build, I'm getting build error

'The type or namespace name 'Mvc' does not exist in the namespace 'System.Web'

(are you missing an assembly reference?). Same with 'Controller', 'ActionResult', 'GlobalFilterCollection' etc (type or namespace could not be found).

I can see System.Web.Mvc.dll in

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\

. What am I missing here? Why NAnt can't find this file? Is there no other way than copying the assembly files into local bin?

beryllium
  • 29,214
  • 15
  • 99
  • 123
Vipin Hari
  • 155
  • 1
  • 3
  • 12

5 Answers5

12

I had the same issue and wasn't able to locate the System.Web.MVC reference assembly.

Finally found out and it was located inside the following location.

Note if your VS was installed in C: (Sometimes the MVC is not in the defaul location which everybody talk about, i mean the "Reference Assemblies" folder located in the C: drive.

if its not there, it should definitely be in here:

Program files(x86) --> Microsoft ASP.NET --> ASP.NET MVC 2 --> Assemblies System.Web.Mvc.dll

Hope this one is helpful.

3

Here is my answer -

Best way is to use NuGet package manager. Just update the below MVC package and it should work

Why is System.Web.Mvc not listed in Add References?

Community
  • 1
  • 1
sandeep talabathula
  • 3,008
  • 3
  • 26
  • 37
3

If you use NuGet packages, you need to update MVC package. This worked for me.

Alexandra Sh
  • 91
  • 1
  • 3
1

If you Installed MVC Package from NuGet packages. simply uninstall package and install it again.

It's work for me

Satish Kumar sonker
  • 1,012
  • 7
  • 14
0

Which version of msbuild are you using to build the web project?
Is the web project referencing a specific version of or file path to System.Web.Mvc.dll?

Download and install ASP.NET MVC 3:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4211

According to: http://weblogs.asp.net/scottgu/archive/2011/05/03/asp-net-mvc-3-tools-update.aspx
"The ASP.NET MVC 3 Tools update only includes Visual Studio tooling improvements and default project template changes – it does not include any changes to the ASP.NET MVC 3 runtime binaries."

Rami A.
  • 9,490
  • 4
  • 37
  • 80