Hector Minaya
Hector Minaya

Reputation: 1705

asp.net mvc 4 website is refusing to build on teamcity

I have a Windows Server 2003 box with teamcity that I use as a build/deployment server. I checked in a new asp.net mvc 4 project and it is crapping out with the following errors:

App_Start\BundleConfig.cs(2, 18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Controllers\AccountController.cs(8, 7): error CS0246: The type or namespace name 'DotNetOpenAuth' could not be found (are you missing a using directive or an assembly reference?)

Global.asax.cs(7, 18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Models\AccountModels.cs(4, 45): error CS0234: The type or namespace name 'Schema' does not exist in the namespace 'System.ComponentModel.DataAnnotations' (are you missing an assembly reference?)

App_Start\BundleConfig.cs(9, 44): error CS0246: The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?) 

I've already installed asp.net mvc 4 on that box, restarted the machine and tried everything else without any luck.

Any ideas?

Upvotes: 1

Views: 4755

Answers (3)

TorontoKid
TorontoKid

Reputation: 733

I am not sure if this will be helpful. But I had same problem. What I was trying to do is using EnableNuGetPackageRestore I was trying to restore it and some where it was causing problem (Restoring nuget packages from Test project rather than MVC project. I am not sure why but if I found out I will surely update thread). What I did is I followed blog from http://blog.jetbrains.com/teamcity/2013/08/nuget-package-restore-with-teamcity/. Adding one more build step NuGet Installer helped me fix issue. (Caution: If you are using internal nuget package server than you need to specify same in Sources). Please let me know if you have still problem and I can be of any help. Happy Building !!

Upvotes: 0

Luke Puplett
Luke Puplett

Reputation: 45155

For me, my CI server (TeamCity) wouldn't take MVC 4 via the Web Platform Installer. Dunno why.

So I checked the TC build logs logs for the yellow warnings, looking for references its trying to resolve.

For each one, I then looked for the corresponding NuGet package in the project/solution and reinstalled it. This sets it up with package restore so that TeamCity/MSBuild restores it during build.

For example:

Update-Package WebGrease -Reinstall

The MVC project template, although it uses NuGet packages, they're not wired-into the whole package restore mechanism for some reason, so reinstalling them forces this. Effectively, I suppose you're installing MVC 4 via its constituent packages.

Luke

Upvotes: 2

Bryan Ray
Bryan Ray

Reputation: 929

A few things I would look in to:

  1. Make sure that your NuGet packages are being pulled down appropriately during the build. Documentation
  2. Make sure that the project is not still referencing the old MVC 3 assemblies somewhere. Perhaps a nant/msbuild build script is copying the old assemblies somewhere?

Upvotes: 0

Related Questions