9

I'm having an odd problem on my build server. I'm using the latest version of TeamCity on Windows Server 2008 R2. I used the web platform installer to install ASP.NET MVC on the build server but, my compilation is still failing with messages that it cannot find the System.Web.Mvc.dll. I've verified that it is on the disk at the expected location:

(C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies)


Here is a selection of the messages:

Controllers\AccountController.cs(7, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\AccountController.cs(15, 35): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\HomeController.cs(9, 32): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) 
Global.asax.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Models\AccountModels.cs(8, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 

So what am I missing?

1 Answer 1

7

The errors you seem to be inferring that it can't find the correct version of the MVC dll. Is it possible you've installed the MVC (original) or MVC2 instead of the MVC3 from the web platform onto the build server?

Edit:

Also the file should be in the GAC, (not sure the location on Win Server 2008 but guessing it's similar to Win 7.)

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\ (then the .Net version folder, mine is v4.0_3.0.0.0)

Sign up to request clarification or add additional context in comments.

2 Comments

Good questions and led me to the answer. MVC 3 was installed and in the GAC. However, it was actually trying to find MVC 2, which I believe is being required because I've installed the MVCContrib NuGet package. When I installed MVC 2 on the buildserver, everything worked fine.
Ah glad it helped, from memory there should be a binding configuration in the web.config that should set all requests for mvc 1 and 2 to use the mvc 3 dll. (but I've never tried it myself so no idea if it would be useful in you situation)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.