To reproduce:
Expect: Builds successfully with no warnings in IDE or solution explorer.
Actual: Builds successfully, but warnings appear in IDE and solution explorer shows yellow warning icon next to references.
This is essentially the same as https://github.com/dotnet/sdk/issues/1244 but a different way to get there. In this case it wasn't simple name conflict resolution but the task.
Because conflict resolution removes the items that were directly authored in the csproj by nuget the IDE emits a warning because it cannot reconcile that the winning items should actually be used.
I think we need to come up with a strategy that works for both places and makes the IDE happy with the consolidated references.
/cc @dsplaisted
A workaround for this is to add the following to your project file:
<Target Name="UpdateOriginalItemSpecs" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<ReferencePath>
<OriginalItemSpec>%(ReferencePath.FileName)</OriginalItemSpec>
</ReferencePath>
</ItemGroup>
</Target>
Is an alternative solution to remove the system.net.http reference from the console app as it's the lib that requires system.net.http?
Sure, for everything that shows up with the yellow bang you can delete it from the CSProj since it will be provided by the targets. That will also work. That would require you to do so after NuGet adds them there (if they are coming from a package in packages.config based project for example).
Is this the same as #1244 with proposed fix in #1454 ?
It's similar but the fix in #1454 may not be big enough. I think we need to consider any case where we might remove items from Reference. For example: conflict resolution.
I confirm these lines seem to solve the issue:
<Target Name="UpdateOriginalItemSpecs" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<ReferencePath>
<OriginalItemSpec>%(ReferencePath.FileName)</OriginalItemSpec>
</ReferencePath>
</ItemGroup>
</Target>
<Reference Include="System.Net.Http" />
or
<Reference Include="System.Net.Http">
<HintPath>..\packages\System.Net.Http\4.3.0\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
Even if the reference came from a nuget package resolved through packagereference, or a targets that added the file.
Most helpful comment
A workaround for this is to add the following to your project file: