System.Web.Mvc missing error while building ASP.NET MVC 3 using NAnt

Vipin Hari picture Vipin Hari · Dec 28, 2011 · Viewed 41.5k times · Source

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?

Answer

user1334789 picture user1334789 · Apr 15, 2012

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.