.Net 2015 References with yellow triangle for Nuget packages on portable libraries

If you've received no output errors during install and there are no Warnings on build/rebuild. Simply:

  1. Restart Visual Studio

I figured out what the problem was!

As mentioned to @Gusman I had my warning switch off. Once I turned them on, I got the following displayed for my portable projects:

Warning: IDE0006 - Error encountered while loading the project. Some project
features, such as full solution analysis for the failed project and projects
that depend on it, have been disabled

and it provided a link to this article Diagnosing Project System Build Errors

After following the instructions provided and inspecting the numerous files ending in designtime.log, I noticed that all of them had a FAIL referring to a Nuget package but as mentioned, I had removed all of them from my various project, so I went to re-check the .csproj from one of them and this is when I spotted the problem(s)!

There are actually 2 problems:

  1. The Microsoft.BCL.Build reference for Nuget does not get remove properly!!

  2. When re-adding Microsoft.BCL.Build Nuget package, it does not set the path correctly in the .csproj

Below is an example of the fault:

<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.21
       \build\Microsoft.Bcl.Build.targets" Condition="Exists
       ('..\..\..\packages\Microsoft.Bcl.Build.1.0.21
       \build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\
        Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format
        ('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21
        \build\Microsoft.Bcl.Build.targets'))" />
    <Error Condition="!Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\
        Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format
        ('$(ErrorText)', '..\..\..\packages\Microsoft.Bcl.Build.1.0.21\
        build\Microsoft.Bcl.Build.targets'))" />
</Target>

As you can see the first line i.e. <Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.21> should not be there and yet it appears to remain in the project even though Microsoft.BCL.Build has been removed.

If you need it leave it and fix the second entry as this is what I did. As you can see there are two entries checking for the Microsoft.BCL.Build Nuget package. In my case, I simply removed the first one:

`<Error Condition="!Exists('..\packages\`

and kept this one:

`<Error Condition="!Exists('..\..\..\packages\`

Once I finished editing the .csproj, I reloaded the project in my solution and not only was the Microsoft.BCL.Build issue resolved, it also resolved all the other Nuget dependencies that were marked with the yellow triangle.

Wasted most of my day on this, but hopefully this will help others.


I faced the same issue on a solution in vs2017 with 2 projects for framework DotNetCoreApp 1.1. All my packages showed the exclamation sign/yellow triangles. Once i ran vs2017 as an administrator, it was resolved.