There are cases where we want to reference a project that is inbox in a given framework which will emit a NU1511 warning as the direct P2P can't be pruned from the restore graph. This is fine as in such a case, it shouldn't be pruned. It would be great if we could NoWarn this warning just for that single P2P so that we still get others flagged.
Example
a.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\b\b.csproj" NoWarn="NU1511" />
</ItemGroup>
</Project>
b.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>System.Collections.Immutable</PackageId>
</PropertyGroup>
</Project>
C:\temp\prunep2p> C:\git\dotnet-sdk-10.0.100-preview.2.25111.9-win-x64\dotnet.exe restore .\a\a.csproj
Restore succeeded with 1 warning(s) in 0.5s
C:\temp\prunep2p\a\a.csproj : warning NU1511: A ProjectReference cannot be pruned, System.Collections.Immutable.
Build succeeded with 1 warning(s) in 1.0s
@nkolev92 maybe NoWarn on an item is only supported for PackageReference and not ProjectReference?
There are cases where we want to reference a project that is inbox in a given framework which will emit a NU1511 warning as the direct P2P can't be pruned from the restore graph. This is fine as in such a case, it shouldn't be pruned. It would be great if we could NoWarn this warning just for that single P2P so that we still get others flagged.
Example
a.csproj
b.csproj
@nkolev92 maybe NoWarn on an item is only supported for
PackageReferenceand notProjectReference?