Fixing NuGet errors after removing Microsoft.Bcl.Build

Share on:

I found that a solution of mine was still referencing the Microsoft.Bcl.Build nuget project, and as I was using Visual Studio 2013, I figured it was no longer needed, so I removed it. After doing this, some of the projects refused to compile, reporting the error:

This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=317567.

After I remembered that this package modifies the project files a little, I fixed the broken projects by:

  • Unloading them
  • Editing them, removing the following lines:
1<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" 
2          Condition="Exists('…" />
3<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="…">
4   <Error Condition="!Exists('…’)"
5          Text="…" HelpKeyword="BCLBUILD2001" />
6   <Error Condition="Exists('…)" 
7          Text="…" HelpKeyword="BCLBUILD2002" />
8</Target>
  • Reloading them

 

Hope this helps someone else.