2
votes

I am trying to complete my first TFS build. However when I queue my build I get lots of compilation errors such as; "The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)"

How do I fix this?

4
Well, do you have a reference to the System.Web.Mvc dll?Brandon
Does the build machine have the correct ASP.NET MVC installed?Richard
I downloaded the MVC framework from here, it was the only link I could find. However I am using .Net framework 4.0 and I do not get the impression this MVC framework is needed.arame3333
Is this perhaps related to the user on the build machine that you installed MVC with? Need Admin?Mark Schultheiss

4 Answers

4
votes

Install Visual Studio and ASP.NET MVC on your TFS Build machine. You didn't mention which version of the MVC Framework you're using so I'll give you links for 2.0 and 3.0:

Install the appropriate verison on your build machine and the errors related to missing references to System.Web.Mvc should be resolved.

2
votes

You need to install the ASP.NET MVC framework on your Build machine as well.

The Build server will look for the MVC assemblies, but won't find them if they are not installed there.

You can download the installer at http://www.asp.net/mvc/mvc3, then simply run it on the Build server.

Good Luck!

1
votes

Alternative solution is to check in System.Web.Mvc.dll into source control, then re-create the reference to system.web.mvc.dll to point to the new location, relative to a project. It is easy to do this for MVC framework, since it is only one assembly.

1
votes

In addition to @SevaTitov's answer:

On my machine these are located at:

\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\*.dll
\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\*.dll

Copy these assemblies to a 'lib' folder in your project, remove any references to these assemblies from your projects, and re-add them from the 'lib' folder. This will change the 'HintPath' in your .CSPROJ file to use them from 'lib' folder when building on the build machine. If developer doesn't sync lib folder VS should still get them from the above assembly search folders, so no harm done, but they will also be found on build machine.