CI Build broke after nugit update

One of those moments where your heart drops : Your using CI on a remote hosting service (like AppHarbor) and your build fails. You look into the fail reason and find out it is because you updated the packages in your build.

Wait, my update from nuGet broke everything?! Wtf?!

The error looks something like this, putting it in here for search engine's :

Build started 6/10/2013 12:30:20 AM.
     1>Project "D:\temp\xly5bsff.qvp\input\.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|Any CPU".
     1>Project "D:\temp\xly5bsff.qvp\input\.sln" (1) is building "D:\temp\xly5bsff.qvp\input\\.csproj" (2) on node 1 (default targets).
     2>D:\temp\xly5bsff.qvp\input\\.csproj(880,3): error MSB4019: The imported project "D:\temp\xly5bsff.qvp\input\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" was not found. Confirm that the path in the  declaration is correct, and that the file exists on disk.
     2>Done Building Project "D:\temp\xly5bsff.qvp\input\\.csproj" (default targets) -- FAILED.
     1>Done Building Project "D:\temp\xly5bsff.qvp\input\.sln" (default targets) -- FAILED.

Build FAILED.

       "D:\temp\xly5bsff.qvp\input\.sln" (default target) (1) ->
       "D:\temp\xly5bsff.qvp\input\\.csproj" (default target) (2) ->
         D:\temp\xly5bsff.qvp\input\\.csproj(880,3): error MSB4019: The imported project "D:\temp\xly5bsff.qvp\input\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" was not found. Confirm that the path in the  declaration is correct, and that the file exists on disk.
"

Simple fix, courtesy of MarC C Brooks on the msdn forums for pointing me to BenHu's awesome fix :
1. Close your project
2. Go to the solution's .csproj file and open it with your fav text editor.
3. Find the following line:
Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" ..

4. Replace it with this one:
Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets"
Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets')" />

5. Open your project again, commit your changes to your local Git.
6. Update your remote repo, in my case it is bitbucket:
   git push origin master:master
7. Open your project again, commit your changes to your local Git
8. Rejoice, build fixed

Comments

Jamie R said…
What I did to fix this issue was loaded up the Package Manager Console (you could also use the regular command line) and fired up this following nuget command.

nuget install .\GlobalInit_MVC\packages.config -OutputDirect packages

This worked great for us.

Popular posts from this blog

Sharepoint 2007 - Access Denied when you try to edit

Project 2010 and Project Pro 2007