4

I have a Team City Nuget build setup which works fine. However, I have tried to update some nuget packages, one of them being: Microsoft.AspNet.Mvc. This was updated from version 5.2.2 to 5.2.3.

This broke the build. Examining the logs I noticed that the nuget package restore seems like it didn't even try to install Mvc. However, the packages folder that was generated by Team City has a Microsoft.AspNet.Mvc.5.2.3 folder but there is no dll file in the lib folder.

I'm at a loss here I don't see why updating to different package version breaks nuget restore.

Any insights on this behavior? Thanks in advance.

Jonny
  • 2,787
  • 10
  • 40
  • 62
  • Did you try to clean local nuget cache? http://stackoverflow.com/questions/18229182/msbuild-nuget-targets-nuget-exe-unable-to-read-package-from-path-blah-nupkg/30254180#30254180 – Rob Jul 02 '15 at 08:46
  • @Rob yep, I even set TC to not retrieve anything from cache – Jonny Jul 02 '15 at 08:47
  • May you share what TC exactly logged? – Rob Jul 02 '15 at 08:49
  • @Rob updated the question with the log for the nuget restore build. As you can see it's not trying to install Microsoft.AspNet.Mvc. Please also note that down grading the packages to the previous version works !! – Jonny Jul 02 '15 at 08:57
  • Hwo package.config looks like for this web project after update to mvc 5.2.3? – Rob Jul 02 '15 at 09:53
  • @Rob here goes: – Jonny Jul 02 '15 at 09:59
  • May I suggest you change the Restore mode to Install and see what effect it has. I also always ensure that "Disable looking up packages from local machine cache" is checked – Matt Jul 02 '15 at 10:12
  • @Rob tried it already and it works but then it still fails when building because it doesn't find the DLLs – Jonny Jul 02 '15 at 10:18
  • So you tried using "Install mode" instead of "Restore Mode" in the NuGet Installer Build Step? (I'm not Rob) – Matt Jul 02 '15 at 10:22
  • The only other things that spring to mind is that the project is not targeting the correct version of the framework. The NuGet installer step looks as though it's setup to use the solution and it'll walk the projects. MVC 5.2.3 targets .Net 4.5.1 so the project must target that too. Just double check that the project file in the working directory of the build agent is up to date and not cached. I would assume it's correct on your dev machine otherwise it wouldn't build locally. I take it the correct version of the framework is installed on the machine too. – Matt Jul 02 '15 at 10:33
  • @DevOps Yep unfortunately everything you mentioned is in order. What baffles me is that the Microsoft.AspNet.Mvc.5.2.3 in the packages directory is there yet the dll did not get downloaded – Jonny Jul 02 '15 at 12:03
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/82200/discussion-between-devops-and-jonny). – Matt Jul 02 '15 at 12:43

2 Answers2

5

Delete the "Microsoft.AspNet.Mvc.5.2.3" package folder completely. The NuGet restore action should recreate this folder and download the assembly or assemblies correctly which are supposed to be in the "lib".

I've got the exact same issue on my build server and that solved the issue.

Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62
  • I had a similar issue. MsBuild / TeamCity had pulled down the NuGet package but the DLL was missing. Deleting the folder caused the package to be downloaded again and this time the DLL was in it. – GrandMasterFlush Jun 09 '17 at 09:16
2

Check all of your projects in the solution and make sure they're targeting the same version of the .NET Framework. I've seen this flip out a build server before.

Also check in your solution packages directory and make sure that all projects that contain references that are packages are listed in the repositories.config file, so that they all get restored properly on the build server.

BeeTee2
  • 777
  • 4
  • 13
  • This really helped me, I had renamed a solution, but the repositories.config file was still pointing to the old solution-name folder – John Lucas Nov 28 '22 at 14:16